2016-09-14 33 views
0

我使用Dapper.Contrib v1.50.0和Dapper v1.50.2。我有用[Key]註解的類中的關鍵屬性,而在數據庫中,列是Identity。當我嘗試插入Sql Server時拋出一個錯誤,該值無法插入到Identity列中。 Dapper.Contrib支持是否插入使用Identity列的表中?Dapper.Contrib支持是否插入使用Identity列的表?

public class Product { 
     [Key] 
     public int ProductId {get; set;} 
     public string BrandCode { get; set; } 
     public bool TwoDScanRequired {get; set;} 
     public string CommodityCode {get; set;} 
     public string Description {get; set;} 
    } 

回答

0

我意識到,我接受使用System.Component.Model.DataAnnotations默認的,它應該是使用了Dapper

相關問題