0

I have the table A like below:

Table A
-----------------------
Id
Desc
ReferenceType
TargetId
...

Depend on the value of reference type, eg 'B' or 'C', target ID reference to table B or table C. Have anyone solve this problem with NHibernate.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
Kieran Dang
  • 447
  • 2
  • 17

2 Answers2

1

You are looking for the mapping <any> have a look at this blog post. Or in this Fabio Maulo Knol look for 5.2.4. Any type mappings

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
0

You need to look at discriminators I think. The following articles should help.

http://nhforge.org/blogs/nhibernate/archive/2009/04/10/nhibernate-mapping-inheritance.aspx

http://ayende.com/blog/3941/nhibernate-mapping-inheritance

Digbyswift
  • 10,310
  • 4
  • 38
  • 66