Guilherme Duarte
Guilherme Duarte

Reputation: 3441

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 saying 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

Upvotes: 0

Views: 1155

Answers (1)

ErikEJ
ErikEJ

Reputation: 41799

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.

Upvotes: 1

Related Questions