views:

21

answers:

0

I'm using NHibernate and Dynamic Proxy. I have one table (Customer) with generic fields: charField1, charField2, etc. One record in this table may represent company A while another record may represent company B. However, a different domain model will exist for company A's data than company B's data because they require different information. Likewise, Company A will make use of a different business logic layer than Company B.

Because of this, CompanyA's record would have different associations with different tables than Company B.

I have been reading about the use of proxies and their capabilities in NHibernate and it seems like this could be useful for my scenario; however, would it be better to simply inherit from BaseCompanyTable?

If I use a proxy, I'm imagining creating interfaces that simply have the appropriate mappings to other tables/domains based on the company's mapping type and that is what the interceptor would handle. My ViewModel would then query only that company information and have the interfaces to deal with. When it saves, the business logic would validate it, post it, the interceptor would only save the BaseCompanyTable.