I need to store a time offset in a database column (for example, 12:25 AM, just the time, no date).
I would like to use the nice data visual modeling capabilities in Visual Studio 2008 to generate dbml and the code to go with it. The database is Sql Server 2005.
Since a TimeSpan is essentially an Int64 (aka long) containing the number of ticks, I tried to store that long in the database.
If however I specify that the column should map to a property of type TimeSpan, Visual Studio reports :
Warning : The custom tool 'MSLinqToSQLGenerator' failed. Unspecified error
To work around this I've mapped the database value to an internal property and I've added a partial class that implements property accessors that convert the integer value from the database to TimeSpan and back.
Is there a way to enable the correct code to be generated for this property? Or is there better way to store a timespan in a SqlServer 2005 database that allows easier access using dbml?