Lynicon has two built-in persistence models, Content persistence, and Basic persistence. Content is the default model. Basic persistence can be set up for any type by inserting the following line in LyniconConfig.cs, at the beginning of the Initialise method:
Code Block |
---|
Collator.Instance.SetupType(typeof(MyContent), new BasicCollator(), new BasicRepository()); |
Other persistence models can be built and used by creating providers implementing ICollator and IRepository, and using them in place of BasicCollator and BasicRepository above.
...
This persistence model is the default. To . To find out how to build a content class for this model, see Declaring a Content Type. To allow a complex data types to be persisted, the content item is serialized as JSON and stored in a field in a standard database record. Metadata about what type of object is stored, what url variable values it is associated with, versioning etc is also recorded. The container for Content Persistence is called ContentItem and it represents the fields in this database record.
...
This model has to be set up for each type that uses it. This To find out how to build a content class for this model, see Declaring a Basic Type. This model essentially maps data types straight onto database records, mapping properties to fields, via Entity Framework. The container here is identical to the data item itself. Basic persistence allows Lynicon to be mapped onto existing SQL data to provide editing fucntions. It also allows the relational functions of Entity Framework to be used. However the type extension system is currently incompatible with these functions and needs to be turned off using the NonCompositeAttribute.