I am trying to migrate a hbm.xml based nhibernate project to mapping by code. I am having problem getting the Version section working. In the hbm.xml i have:
< version name="Version" column="Version" type="Int32" unsaved-value="0"/>
I have tried with the following mapping:
Version(x => x.Version, m =>
{
m.Column(c =>
{
c.SqlType("Int32");
c.Name("Version");
});
m.Generated(VersionGeneration.Always);
m.UnsavedValue(0);
m.Insert(true);
m.Type(new NHibernate.Type.Int32Type());
});
But nothing seems to produce the same mapping as the original hbm.xml, they all end up without the type="Int32". Has anyone got any ideas how I can do this, or if its supported in 3.2?
Cheers
Update:
See my answer