Try fast search NHibernate

05 November 2010

ConfORM : Thoughts about interfaces as relation

As said in the previous post the most “easy” part related to polymorphism is done. Now is the time to give more intelligence to the “muchachota” (some BuenosAires guy will understand what it mean… btw, for others, with  “muchachota” I’m referring to ConfORM project).

I need your help thinking about the behavior that ConfORM should have in these cases:

Case 1:
An interface is implemented only by a root-entity and thus by the whole hierarchy.

Case 2:
An interface is implemented only by an entity (not root-entity) and thus by its own hierarchy-branch.

Case 3:
An interface is implemented only by a component and thus by its own hierarchy.

Case 4:
An interface is implemented by more than one root-entity or no-root-entity and thus by its own hierarchies

Case 5:
An interface is implemented by a root-entity, a no-root-entity, a component and it is used in a relation (close the house and go to the church).

ConfORM should discover all cases:
The ObjectRelationalMapper (IDomainInspector) should provide the correct response of IsEntity, IsRootEntity, IsManyToOne, IsComponent, IsHeterogeneousAssociation.
The Mapper, perhaps through the IDomainInspector, should have an applier to be able to apply the correct concrete-class in each case.

For case-1 and case-2 ConfORM may generate even the node <import> to use those interfaces in HQL.
For the case-4 ConfORM should provide a way to interpreter the relation as heterogeneous-association by default.
For the case-5 I don't think I can do something.

NOTE: each case is already supported but only using explicit declarations/customizers
A sample domain is available in the source code in ConfOrmTests.InterfaceAsRelation.Domain.cs
Any help will be appreciated (“help” does not mean “patch”).

Update (2010-11-06): Case-1 supported and tested for many-to-one in simple domain.
Next updates will be available seeing commits.

No comments:

Post a Comment