nhibernate - autopmapping with UseOverridesFromAssemblyOf doesn't call overriding classes of base class -


i'm using automapping fluent nhibernate, simply, so:

fluently.configure()             .database(mssqlconfiguration.mssql2008             .connectionstring(c => c                 .server("(local)\\sql2008")                 .database("nhibernate_test")                 .trustedconnection()))             .mappings(m => m.automappings.add(                 automap.assemblyof<domain.airport>(cfg)                 .useoverridesfromassemblyof<readermappingoverride>()                 )) 

my overriding classes that:

public class readermappingoverride : iautomappingoverride<domain.reader> {     public void override(automapping<domain.reader> mapping)     {         //use reader id identifier of class, instead of id field defined in superclass entity         mapping.ignoreproperty(r => r.id);         mapping.id(r => r.readernumber);     } } 

where reader abstract base-class. if use seperate overriding classes each sub-class works ok. there way define overriding subclasses of abstract class?

thanks,
jhonny

ok, answered own question- problem was trying map heirarchy started reader class, single table. auto-mapping automatically ignores abstract classes. did add configuration section:

.mappings(m => m.automappings.add(                 automap.assemblyof<domain.airport>(cfg)                 .includebase<domain.reader>() 

and configuration class

public override bool isdiscriminated(type type)     {        //this line indicates readers heirarchy should in 1 table, instead of seperate tables every type of reader         bool ret = type.issubclassof(typeof(domain.reader)) || type == typeof(domain.reader) ;         return ret;     } 

(btw, example given in fluent nhibernate's site uses method "type.in(..." not exist in .net 3.5...)
worked fine.
hopes helps...


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -