Entity Framework code first with type TimeStamp

I am using SQL Server 2008 R2 and Entity Framework 5.0. When the database is generated, I cannot add my TimeStamp type property without error: There is no store type matching the conceptual side type

'Edm.Time (Nullable = True, DefaultValue =, Precision =)' of the primitive type 'Time'.

I set Entity configuration for time type or timestamp without success

Property(x => x.RestBetweenSet).HasColumnType("timestamp");

When I go to Sql Server Management Studio and edit the table, I can set the time column.

What do I need to do so that the Entity Framework code can create this column first?

thank

+5
source share
3 answers

INT64 TimeStamp. .

, . .

+3

:

[Timestamp] 
public Byte[] MyTimestamp { get; set; }
+11

I'm not sure I understand your question correctly, but this is how I generate fields timestampusing an approach code firstandentity framework

[Required, DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime CreatedAt { get; set; }
0
source

All Articles