Persistence Models
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:
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.
Content and Basic persistence are described below.
Content Persistence
This persistence model is the default. 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.
The main disadvantage with this method is that it makes it difficult to efficiently find data related to the content item. The simplest method for avoiding this restriction is to use the SummaryCache module which removes this problem by caching summaries for all content items in memory.
Basic Persistence
This model has to be set up for each type that uses it. 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.