/
Data System Configuration

Data System Configuration

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.

If there is not going to be a DataRoute<T> set up for your content type T, i.e. if you are only going to access it's data directly through calls to the Data System, you need to do add the following line to LyniconConfig.cs in the Initialise() method:

ContentTypeHierarchy.RegisterType(typeof(T));

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().  The code for this is:

Collator.Instance.Register(typeof(T), new BasicCollator());
Repository.Instance.Register(typeof(T), new BasicRepository(new CoreDataSource()));

There is a specific shortcut to set up the above configuration (i.e. to use basic persistence):

Collator.Instance.SetupTypeForBasic<T>();

Build Custom Providers


Related content

Data System Configuration
Data System Configuration
More like this
Data System Configuration - ASP.Net Core
Data System Configuration - ASP.Net Core
More like this
Persistence Models
Persistence Models
More like this
Declaring a basic type
Declaring a basic type
More like this
Declaring a basic type
Declaring a basic type
More like this
Content type attributes
Content type attributes
More like this