Time (CLR Timespan) column using EF4.1 Code-First approach and SqlCe 4.0
I'be been trying to map a Timespan property to a SqlCe 4.0 database using EntityFramework 4.1 Code-First approach, and of course I'm getting a NotSupportedException sa开发者_运维百科ying there's no store corresponding EDM type 'Time' and CLR type 'Timespan'.
I was already expecting this, but, according to this article, there's a conversion support since SqlCe 3.5 that maps a nvarchar(16) in the value form of 'hh:mm:ss.nnnnnnn' to a Time column.
Does anyone know if it's possible to use this with EF4.1 Code-First?
Regards
The linked article refers to Merge Replication, not data type mapping in EF. You must either use a string and convert to and from timespan in code, or use datetime.
精彩评论