当我使用 add() 将实体输入到数据库时,我得到以下 SqlException(对象已存在)
Violation of PRIMARY KEY constraint '....'.
Cannot insert duplicate key in object 'PROJ.DesignProjects'.
The duplicate key value is ... The statement has been terminated."}
System.Exception {System.Data.SqlClient.SqlException}
然后我修复它以在添加之前运行删除,我得到
{"An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key."}
那我该怎么做呢?