Why is Fluent NHibernate ignoring my convention? -
i have convention usertypeconvention<myusertype>
myusertype : iusertype
myusertype
handles enum type myenum
. have configured fluent nhibernate thusly
sessionfactory = fluently .configure() .database(mssqlconfiguration.mssql2005.connectionstring( c => c.is(connectionstring)) ) .mappings( m => m .fluentmappings .addfromassemblyof<a>() .conventions .addfromassemblyof<a>() ) .buildsessionfactory();
where a
type in same assembly usertypeconvention<myusertype>
, myusertype
. however, fluent nhibernate not applying myusertype
properties of type myenum
on domain objects. instead, applying fluentnhibernate.mapping.genericenummapper<myenumtype>
these properties.
what going on?
for have solved with:
public class myenumusertypeconvention : usertypeconvention<myenumusertype> { public override void accept(iacceptancecriteria<ipropertyinspector> criteria) { // fluent nhibernate eager in applying genericenummapper // our criteria is applied type criteria.expect(x => x.type == typeof(genericenummapper<myenum>)); } public override void apply(ipropertyinstance instance) { // override fluent nhibernate's application of genericenummapper instance.customtype<myenumusertype>(); } }
i think should thoroughly unnecessary. if told me bug in fluent nhibernate, that'd fine. if gave me reason why fluent nhibernate should eager in applying genericenummapper
acceptable too.
Comments
Post a Comment