We have been using a system that allows us to combine and reuse the
same business entities within different projects, even when those
projects have different requirements for relationships between the
entities or different properties on the same entities.  We do this by
taking advantage of interfaces.  A unique set of concrete classes is
utilized when the project is run and all code works against the
interfaces so it doesn't care which concrete clsss is present.  Here's
a web page with a diagram that describes what's going on:

    
https://info.pleasantsolutions.com/Documentation/Pleasant_Modeller/Nested_Models

<shameless plug>
If you like this approach, we do sell the "Pleasant Modeller" as a
product.  It's a bit rough in the UI, but the functionality provided
by the code generation is excellent.  Just a couple examples,
automatic observability for WPF and automatic bi-directional
associations. It's available at http://www.pleasantsolutions.com/modeller/
and we're happy to help get you running.
</shameless plug>

In any case, because we work against interfaces, it would be nice to
query against interfaces.  From the perspective of a single
application, there are multiple interfaces that map to a single
concrete class... note that this is different than the usual single
interface that maps to multiple concrete classes.  As such, I'd like
to have a mechanism in NHibernate to associate different interfaces
with that single concrete class.  A very naive glance indicates this
may be as simple as adding to the entitypersisters map.  For mapping,
I was thinking something along the lines of:

<class name="Category">
  <alias name="ICategory"/>
</class>

Thoughts?

Reply via email to