【发布时间】:2013-10-29 19:06:02
【问题描述】:
我正在 Nopcommerce 中创建一个插件,并使用我的插件创建了一个数据库表。
在那个插件中,我在服务中使用了 GetListByProductId(int id) 和 InsertItem(Item item) 方法。
我已经实现了这些方法,如下所示:
public void InsertItem(itemList item)
{
if (item == null)
{
throw new ArgumentNullException("itemlist");
}
//Persist
_itemlistRepository.Insert(item);
}
public virtual ItemList GetListByProductid(int ProductId)
{
if (ProductId <= 0) return null;
return _itemlistRepository.GetById(ProductId);
}
但我收到错误消息,“支持 'ItemObjectContext' 上下文的模型在创建数据库后发生了变化”。
我不明白为什么会发生此错误以及从何处发生。
谁能帮我解决这个问题?
接受所有答案。
感谢期待。
【问题讨论】:
-
您可以查看以下链接吗? stackoverflow.com/questions/3600175/…
-
嘿,谢谢,但我已经添加了 Database.SetInitializer
(null);在我的 Install() 和 UnInstall() 方法中。 -
您是否查看过有关创建数据插件的官方文档? nopcommerce.com/docs/75/plugin-with-data-access.aspx
-
我使用这个参考创建了我的插件。
标签: c# nopcommerce