inheritance - Fluent NHibernate Create entity mapping for overlapping entities -
for eg. have 2 tables in database
nonresidentstudents - columns studentid, studentname, modeoftransport
residentstudents - columns studentid, studentname, dateofjoininghostel
studentid , studentname common columns , last column uncommon between two
for reason, cant change these tables or define common master table , make uncommon columns in sub tables. table stucture rigid.
now when trying create entity , mapping above schema using fluent nhibernate (only) know if can define sort of common entity , common mapping common columns , create child entities inheriting common entities. in child entity , mapping class have representations uncommon columns. please share code of how it.
i did before.
common class
public class basemapping : classmap<entitybase>{ public basemapping () { useunionsubclassforinheritancemapping (); // rest of mapping attributes } }
for individual classes inherit base this:
public class departmentmapping : subclassmap<department> { public departmentmapping () { abstract (); // map unique attributes } }
the code above create 1 class based on department , entitybase. not create table called entitybase.
Comments
Post a Comment