can you re-use nhibernate mapping files for tables with common columns -
we have bunch of lookup tables share same columns (id,code,description, etc) , co-worked asked me if build generic lookup.hbm.xml mapping file , use base other lookup tables. nhibernate support include files, or other way reference common chunk of xml? understand fluent supports inheritance in mapping classes, unfortunately switching mapping technologies not option us.
yes, can using xml external entities. put common fields in xml file , reference them in other xml files using !entity
. example:
<!doctype mappings [ <!entity address system "xxx.address.xml"> ]>
in xml nhibernate map import using
&address;
the full namespace (path) file needs used. have noticed in visual studio (2008 @ least) if there error in file , have xml file open uses external reference, report error on also.
Comments
Post a Comment