Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF

前端 未结 22 1556
我在风中等你
我在风中等你 2020-11-22 13:56

I have the below error when I execute the following script. What is the error about, and how it can be resolved?

Insert table(OperationID,OpDescription,Filte         


        
22条回答
  •  暖寄归人
    2020-11-22 14:48

    The problem raised from using non-typed DBContext or DBSet if you using Interface and implement method of savechanges in a generic way

    If this is your case I propose to strongly typed DBContex for example

    MyDBContext.MyEntity.Add(mynewObject)
    

    then .Savechanges will work

提交回复
热议问题