2
我有一個帶有TimeStamp
列的SQL表。相應的EF實體低於插入帶有時間戳記的SQL表中的記錄數據類型
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; }
}
的VersionStamp
酒店有數據類型timestamp
是SQL
在C#中我創建了一個新的實體,並調用的SaveChanges()
var request = new Request()
{
ClientID = "XYZ",
CreatedDateTime = DateTime.Now,
ModifiedDateTime = DateTime.Now,
};
await _DBContext.SaveChangesAsync().ConfigureAwait(false);
,但我得到的錯誤
「」無法在時間戳列中插入顯式值。使用INSERT 帶有列表列表以排除時間戳列,或將缺省值插入到時間戳列。「
我不是在代碼中的任何地方設置timestamp
。我期待SQL會自動更新列值