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 use. I am able to correctly map the entity with NHibernate 2 and FluentNHibernate.
NHibernate 2 w/Fluent Mapping
public class EntityMapping : ClassMap<Entity>
{
public EntityMapping()
{
Table("EntityTable");
Id(x => x.EntityId).Column("EntityId").GeneratedBy.Identity();
Map(x=>x.Code).Not.Nullable().Column("EntityCode").CustomType("AnsiString");
}
}
NHibernate 3 w/loquacious API
public Action<IClassMapper<Entity>> CreateMapping()
{
return ca =>
{
ca.Table("Entity");
ca.Id(x => x.EntityId, map =>
{
map.Column("EntityId");
map.Generator(Generators.Identity);
});
ca.Property(x => x.Code, map =>
{
map.Column(cm => {
cm.Name("EnityCode");
cm.NotNullable(true);
});
});
};
How/where do I specify "AnsiString" (so queries against code are parameterized as 'varchar' instead of 'nvarchar' when the SQL is constructed)?
I am using Sql Server 2008.