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 by 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()));
0 Comments