Using Time Columns With Nhibernate, Fluent Nhibernate And Sql Server 2008
I have a table with a time column in my SQL Server 2008 database. The property of the object I'm trying to map to is a TimeSpan. How can i tell FluentNHibernate to use the TimeAsTi
Solution 1:
This is working for me:
Map(x => x.TimeFrom)
.CustomType("TimeAsTimeSpan");
Solution 2:
And if you're using the conventions, then this does the job for me:
publicclassPropertyConvention : IPropertyConvention
{
publicvoidApply(IPropertyInstance instance)
{
if (instance.Property.PropertyType == typeof(TimeSpan))
instance.CustomType( "TimeAsTimeSpan" );
}
}
Solution 3:
You should be able to map it using CustomType.
Post a Comment for "Using Time Columns With Nhibernate, Fluent Nhibernate And Sql Server 2008"