I have the following mapping:
public class LogEntryMap
{
public LogEntryMap()
{
Map.Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.Context).CustomSqlType("varchar").Length(512);
}
}
However, using SchemaExport to generate the database in SQL Server 2008, the script generated ignores the length so in effect it ends up being a varchar with length of 1:
create table OV_SAC.dbo.[LogEntry] (
Id BIGINT IDENTITY NOT NULL,
Context varchar null,
primary key (Id)
)
.CustomSqlType("varchar 512") throws an exception. And without defining the CustomSqlType, strings are mapped to nvarchar (which does respect the Length property).
Any suggestions?