views:

30

answers:

0

Hi,

I have a homebrew "ORM" solution that I want to migrate to nhibernate, but I can't seem to find a solution to the inheritence mapping I use and a matching one i NH.

Here is what my current solution looks like:

Example one to many:

Type1 "1 - *" Type2

Type2
 - Type1Id

If there is inheritance on Type1 then in Type2 I have a second FK-field that points to which class it's refering, Type1ClassId. This is the part where my orm finds out how to find the correct table/entity.

Example many to many:

Type1 "* - *" Type2

Type1ToType2
 - Type1Id
 - Type2Id

If inheritance the same goes here

Type1ToType2
 - Type1ClassId
 - Type1Id
 - Type2ClassId
 - Type2Id

Is there some way this can be mapped in NH?

related questions