tags:

views:

102

answers:

4

From http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

"developers typically adopt one of the other two approaches, more complex in outlook but more efficient when dealing with relational storage: they either create a table per concrete (most-derived) class, preferring to adopt denormalization and its costs, or else they create a single table for the entire hierarchy, often in either case creating a discriminator column to indicate to which class each row in the table belongs. (Various hybrids of these schemes are also possible, but typically don't create results that are significantly different from these two.) Unfortunately, the denormalization costs are often significant for a large volume of data, and/or the table(s) will contain significant amounts of empty columns, which will need NULLability constraints on all columns, eliminating the powerful integrity constraints offered by an RDBMS."

I would like to know which ORMs use one or the other way especially the ones which use a single table and in .NET ?

+1  A: 

especially the ones which use a single table and in .NET ?

LINQ-to-SQL can use the single-table / discriminator approach. An example is given here.

Marc Gravell
Thanks thumb up
programmernovice
+1  A: 

NHibernate supports the single table approach.

Ola Herrdahl
Thanks thumb up
programmernovice
+4  A: 

I think most of leading ORM tools allow to use different inheritance scheme, including single table.

I can mention DataObjects.Net, which used class table inheritance scheme only in previous versions. But this product was completely rewritten and now allows to use three different inheritance scheme: Class table, Single table and Concrete table.

Alex Kofman
Could you quickly precise the difference between the 3 or give a link ? Thanks.
programmernovice
Single table: http://martinfowler.com/eaaCatalog/singleTableInheritance.html Concrete Table: http://martinfowler.com/eaaCatalog/concreteTableInheritance.html ). Class Table: http://martinfowler.com/eaaCatalog/classTableInheritance.html
Alex Kofman
Will read them, thanks.
programmernovice
+1  A: 

The Sense/Net Content Repository is an ORM where there is a fixed schema for the hierarchy: about 15 tables take care of all the mapping which is defined by an XML.

NHibernate is not an example of a single table approach as one has to define separate tables for each object and then define the schema binding as well one by one. That is the apporach of table per concrete.

Gergely Orosz
Seems great thanks a lot !!!
programmernovice