I'm using NHibernate with ConfORM to map my domain entities.
Assuming the following classes:
public class Event {
public virtual Guid Id { get; set; }
public virtual string Title { get; set; }
public virtual bool Active { get; set; }
}
public class EventA : Event {
public virtual string PropertyA { get; set; }
}
public class EventB : Event {
public virtual string PropertyB { get; set; }
}
I need not repeat NHibernate tables fields in derived classes, but uses the base class, as in the diagram.
My ConfORM setup :
var domainAssembly = typeof(Event).Assembly;
var domainEntities = from t in domainAssembly.GetTypes() where t==typeof(Event) select t;
var orm = new ObjectRelationalMapper();
orm.Patterns.Sets.Add(new UseSetWhenGenericCollectionPattern());
orm.Patterns.PoidStrategies.Add(new ConfOrm.Patterns.IdentityPoidPattern());
orm.TablePerConcreteClass(domainEntities);
var patternsAppliers = new CoolPatternsAppliersHolder(orm);
var mapper = new Mapper(orm, patternsAppliers);
[...]
Any ideas on how to approach the problem could?
exchange
orm.TablePerConcreteClass(domainEntities);
withorm.TablePerClass(domainEntities);
which will createbecause a seperate Id column in EventA is not nessesary