My appologies if this has been discussed before.
I have a table that is able to reference any other table. It does this by storing the table name and primary key of the foreign record in a pair of string fields.
What is the cleanest way to handle this?
I'm basically trying to avoid having to write the lookup code myself but still be able to use my objects as follows:
Code:
if (obj.Parent is Car)
//do something
else if (obj.Parent is Horse)
//do something else
Note that my "Car" and "Horse" objects in the above example do not inherit from anything common.
I'm also trying to keep my objects free from NHibernate references.
Cheers