找不到实体框架的"添加"方法

Dev*_*per 0 c# entity-framework

  1. 我创建了DLL项目

  2. EDMX从数据库中创建并构建了模型

  3. 我真的很喜欢

MyEntities context = new MyEntities();
var p = new Product();
context.Product.Add // and there is no Add method.
Run Code Online (Sandbox Code Playgroud)

那么我做的事情有什么问题?

谢谢!

Gui*_*gui 7

使用EF命名约定,应该是 context.Products.Add()

对象的集合以对象的名称加上"S"命名,因此ProductProducts在上下文中创建集合