views:

119

answers:

1

I have a table that needs relations to 2 tables, according to ObjectType column.

For example if ObjectType=1 then column Object should point to TABLE1, and if ObjectType=2 then point to TABLE2.

Can I accomplish this in NHibernate mappings or as Fluent NHibernate?

If not will you suggest me using same Interfaces for both Table classes? (Note: table schemas are totally different)

A: 

Why not reference both tables, and use one or the other according to your needs in the class code? Use a property that returns a common interface for both tables and gives one table or the other according to the object type.

gcores

related questions