Adapting different database strucure

Topics: General
Jun 21, 2011 at 3:38 PM

How difficult would it be to adapt a different structure layer with nhibernate.

Coordinator
Jun 21, 2011 at 10:28 PM

What do you have in mind? This is extremely vague.

Jun 21, 2011 at 10:45 PM
bertrandleroy wrote:

What do you have in mind? This is extremely vague.

I have already an existing database structure which is built similarly to orchard:

I got products (aka ContentItem in Orchard) and their properties.

All properties are stored in one table with a relation to the product. The properties of a product are also defined by a product type (aka Content Type).

 

Every ContentPartRecord would be a ContentType with it's properties and every ContentType would be a bunch of ContentPartRecords and the Fields on the ContentItem itself.

The very huge difference is that we wouldn't have a table per model, but one table with all properties.

 

All other models could be as tables in the database, but the content Items and it's part records and fields in our already existing structure.

Thank you very much for your commitment.

Coordinator
Jun 21, 2011 at 11:12 PM

Ah, so the problem really is access to existing data. Well, yes this can be done and has been done by several people. There is no obligation for content item data to come from the Orchard database. You are certainly going to lose in terms of queryability but this can be done by handling the persistence and querying yourself. If you look at existing handlers, that line that they all have that sets up persistence through a default repository is your starting point.

Others who have done this before could probably chime in with their own experiences.