Carnotaurus CMS - Deciding upon a CMS Data Storage Schema
After you have decided to write your own CMS, you may consider how you might want to store your data. In any way, you might want to walk your existing database tables (assuming that you currently have your data stored in a database) into one of the following CMS structures:
Xml-based CMS style data storage
CMS style database storage – a set meal
Let us assume the first option. If you opt to store data in a database in some kind of CMS style then you would need to decide upon a structure.
We consider the following page hierarchy (using a simplified EPiServer terminology) and assuming no page versioning:
For each table in your current database, you might consider having a corresponding row in a Page Type table
For each row in each table in your current database, you might consider having a corresponding row in a Page definition table
For each column in each table in your current database, you might consider having a corresponding row in a Properties definition table which also includes a value for that property
The list goes on and you may even have a role of Dynamic properties.
The key is that you could, in principle, migrate any non-CMS style database to a CMS style database in this way.
Xml-based CMS style data storage - half chips half rice
The issue with creating a database schema in the initial stages like the one described above is that it could be difficult to change downstream. This is especially the case if you use dynamic Sql and other techniques that blur relation object to database mappings. The storage of data in a project such as this one could reflect the emerging design of the page hierarchy object model. Storing data in an XML structure which maps directly to the objects used in the application makes a lot of sense:
It is easy to change where a database schema in my experience is often not.
A direct mapping between an object and xml facilitates serialization and deserialization for such object mapping
If there is ever a need to use a database (such as Sql Server, Oracle, Microsoft Access, or any other database format) then it would not be too much work to move from XML-based data storage and write a data provider.
It would be easier to export or transform xml than any non-flat proprietary format
Using a strict database schema early in the application could impose unnecessary rigidities for data storage. The use Xml has several advantages over database storage. There are no great disadvantages, not even performance as entities (e.g., pages) would be cached in IIS, irrespective of whether we are talking about database or xml. There could be an option to generate both the Data Access Layer and Business Layer could be automatically generated from the Xml. This would prove useful for the creation of strongly type classes and validation. So, Xml storage is the route that Carnotaurus CMS follows for the moment.