How can I stop Fluent NHibernate automapping from creating foreign keys across the database? -
i using latest version of fluent nhibernate automapping. there convention or property can set stop creating foreign key constraints across tables? have 200 classes, cannot go each individual class , property name , set
foreignkeyconstraintnames("none", "none")
how can add foreignkeyconstraintnames("none", "none") in automapping? don't want hardcode table name or column name. have automapping create mappings without foreign keys. basicall don't create foreign keys across database. how can this? there similar post here answer not clear me.
a simple convention
public class noforeignkeys : ireferenceconvention, ihasmanyconvention { public void apply(imanytooneinstance instance) { instance.foreignkey("none"); } public void apply(ionetomanycollectioninstance instance) { instance.key.foreignkey("none"); } } // use automap.assemblyof().conventions .fromassembly() or .add(typeof(noforeignkeys))
Comments
Post a Comment