mysql - fluent nhibernate automapping one to many makes foreign key null -


i relatively new nhberinate , , using alternative ef cause works nicely on mono.

all entities mapped automapping.

the problem have 1 many relationship setup. 1 of item class has of localizedtext class. setup convention cascade all.

 public class cascadeall : ihasoneconvention, ihasmanyconvention, ireferenceconvention  {     public void apply(ionetooneinstance instance)     {         instance.cascade.all();     }      public void apply(ionetomanycollectioninstance instance)     {         instance.cascade.all();      }      public void apply(imanytooneinstance instance)     {         instance.cascade.all();     } } 

when add localizedtext item class, works well, , localizedtext table gets values written table, however..the foreign key value "itemid" remains null. how can make work localizedtext items have objectid when added?

zack

great when find answer own questions.

in order correct sql executed objects have relationships, code saving objects should between following method calls. begintransaction() , committransaction(). when committransaction called, values written database, fields have no value automatically assigned zero, instead of null in earlier case.


Comments