开发者

Time (CLR Timespan) column using EF4.1 Code-First approach and SqlCe 4.0

开发者 https://www.devze.com 2023-04-09 23:37 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号