首页 > 解决方案 > 实体框架增量不起作用?给出错误

问题描述

你好,我的代码增量不起作用,因此它给了我错误,我不知道这有什么问题。我的列是主要的,因为自动增量是 ON

foreach (var item in Items)
{
    using (var db = new TempDGREntities())
    {
               //code here auto incrementing
        using (var context = new TempDGREntities())
        {

            try
            {
                foreach (var car in list)
                {
                    //code here NOT auto incrementing
                }
            }
            catch (Exception ex)
            {
            }
        }
    }
}

标签: c#sqldatabasealgorithmentity-framework

解决方案


推荐阅读