I\'m trying to map an Entity with a string property to a varchar column in NHibernate 3 using the new Loquacious API but I can\'t figure out how to specify the Type to
An answer to the question itself ("specify sql type") would be to define the property like this:
ca.Property(x => x.Code, map =>
{
map.Column(cm => {
cm.Name("EnityCode");
cm.NotNullable(true);
cm.SqlType("varchar");
});
});
Directly specifying the SQL type should be considered a hack which is not necessary here, though. It's preferable to use the map.Type(NHibernateUtil.AnsiString);
solution and have NHibernate deduce the SQL type.
ca.Property(x => x.Code, map =>
{
map.Type(NHibernateUtil.AnsiString);
map.Column(/*etc.*/);
});