I have a SQL Table with TimeStamp
Column. The corresponding EF entity is below
public partial class Request : IEntityBase
{
public Request()
{
}
public int RequestID { get; set; }
public Nullable<int> BatchID { get; set; }
public string ClientID { get; set; }
public Nullable<System.DateTime> CreatedDateTime { get; set; }
public Nullable<System.DateTime> ModifiedDateTime { get; set; }
public byte[] VersionStamp { get; set; }
}
The VersionStamp
property has datatype timestamp
is sql
In C# i create a new entity and call savechanges()
var request = new Request()
{
ClientID = "XYZ",
CreatedDateTime = DateTime.Now,
ModifiedDateTime = DateTime.Now,
};
await _DBContext.SaveChangesAsync().ConfigureAwait(false);
But i get error
"Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column."
I am not setting timestamp
anywhere in the code. I was expecting SQL will automatically update the column value