Can nHibernate map the corresponding table based on the column value?
create table Table1 (attributeName varchar (100), attributevalue varchar (100), attributeLookupMethod varchar (50))
create table Table2 (attributeName varchar (100), CSVAllowableValues ββvarchar (1000)
Based on the above two tables, using nHibernate is it only possible to get data from table2 when Table1.attributeLookupMethod = 'Lookup'?
Thanks.
Implement subclasses in your two tables.
You will have a class for Table1 and a class for Table2 that will extend the former. In Table 1, the mapping declares the "attributeLookupMethod" field as a discriminator. In the mapping for the Table2 subclass, declare the discriminator value as "Search".
So it might be useful to declare a shared primary key (possibly an attribute name) and a foreign key from table 2 to table1
a source to share