【发布时间】:2016-09-14 13:28:32
【问题描述】:
我正在使用 Dapper.Contrib v1.50.0 和 Dapper v1.50.2。我在用 [Key] 注释的类中有 key 属性,而在数据库中,该列是 Identity。当我尝试插入 Sql Server 时,会抛出一个错误,即无法将值插入到 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;}
}
【问题讨论】:
标签: sql-server dapper