我在我的代码中使用 Linq 进行插入、删除和更新数据库。使用 InsertOnSubmit 插入数据时,出现 cannot add an entity that already exists
异常。请看看我的代码
private static void AddNewPriceSettings(PRICE_SETTING priceSettingsInfo)
{
PRICE_SETTING priceSetting = new PRICE_SETTING();
priceSetting = priceSettingsInfo;
DataContext.CommonUsers.PRICE_SETTINGs.InsertOnSubmit(priceSettingsInfo);
DataContext.CommonUsers.SubmitChanges();
}