如何添加“选择” MVC3 应用程序中 EF4.1 查询的子句
我在 MVC3 应用程序中有一个简单的实体框架查询,如下所示
var instances= db.Instances.Include(c => c.CompanyLead).Include(c => c.SalesLead).Include(c => c.Customer);
return View(instances);
该查询工作正常并且基本上返回所有实例。但是,我需要过滤此查询并基本上添加短语:
var instants= db.Instances.Include(c => c.CompanyLead).Include(c => c.SalesLead).Include(c => c .Customer)WHERE InstanceType = x
我不想恢复为具有 DB Context 对象的 ObjectQuery 类。我想我可以改变这个查询。我错了吗?
I have a simple entity framework query in an MVC3 app, like so
var instances= db.Instances.Include(c => c.CompanyLead).Include(c => c.SalesLead).Include(c => c.Customer);
return View(instances);
This query works fine and essentially returns all instances. However, I need to filter this query and basically add the phrase:
var instances= db.Instances.Include(c => c.CompanyLead).Include(c => c.SalesLead).Include(c => c.Customer)WHERE InstanceType = x
I don't want to revert to an ObjectQuery class with a DB Context object. I thought I would be able to alter this query. Am i wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)