I'm using Entity Framework Core and trying to insert an entity (with a timestamp) into the database, but an exception is thrown
Cannot insert an explicit value into a timestamp column...
I got the generated SQL from EF when insert, and tried to run manually that code, but it does not work.
exec sp_executesql N'SET NOCOUNT ON;
INSERT INTO [PersonalLookup] ([Description], [IsDeleted], [LookupTypeId], [ProfileId], [Timestamp])
VALUES (@p0, @p1, @p2, @p3, @p4);',
N'@p0 nvarchar(4000),@p1 bit,@p2 int,@p3 int,@p4 varbinary(8000)',
@p0=N'test',@p1=0,@p2=1,@p3=1,@p4=NULL
When I run the SQL code below, system returned with same error about the timestamp. Is that the EF problem? Because I check the fluent included the IsRowVersion
and the timestamp is non-nullable in the database.