Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 TimeAsTimeSpan NHibernate type, so that I don't have cast problems?

like image 870
Guillaume Davion Avatar asked Feb 04 '23 06:02

Guillaume Davion


1 Answers

This is working for me:

Map(x => x.TimeFrom)
    .CustomType("TimeAsTimeSpan");
like image 187
Ian Nelson Avatar answered Feb 05 '23 19:02

Ian Nelson