Dapper.Contrib是否支持插入使用Identity列的表?

时间:2016-09-14 13:28:33

标签: sql-server dapper

我使用的是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;}
   }

1 个答案:

答案 0 :(得分:0)

我意识到我使用System.Component.Model.DataAnnotations接受了默认值,它本应该使用Dapper

相关问题