Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Data System is highly configurable, below different types of configuration are described from most basic to most complex.

Register a Type

Data system providers are registered for each data type which needs to be handled by the system at the 3 different levels of the data system.  By default, when a DataRoute<T> is created, the system sets up the type T to be handled by Lynicon.Collators.ContentCollator, Lynicon.Repositories.ContentRepository and Lynicon.DataSources.CoreDataSource.  See Built-In Data Providers for a description of how each of these function, or read about content persistence in Persistence Models.

...

Code Block
languagec#
services.AddLynicon(options =>
	options.UseConfiguration(Configuration.GetSection("Lynicon:Core"))
    	.UseTypeSetup(tsr =>
    	{
			tsr.SetupType(typeof(TestData));
		})
    );

Register Providers for a Type

This is done by registering an appropriate provider object with the service locators Collator.Instance and Repository.Instance.  This should ideally be done in LyniconConfig.cs in the InitialiseDataApi() method above the final call to Collator.Instance.BuildRepository().  Example code for this is:

Code Block
languagec#
...
tsr.SetupType(typeof(TestData), new BasicCollator(null), new BasicRepository(new CoreDataSourceFactory()));
...

Register a Diverter (for editing) for a Type

Code Block
languagec#
...
tsr.SetupType(typeof(TestData), new BasicCollator(null), new BasicRepository(new CoreDataSourceFactory()), DataDiverter.Instance.NullDivert);
...

...