Far*_*yev 3 c# linq entity-framework
我在我的项目中使用Linq-To-Entity.但是,我在使用Stored Procedure或LINQ to Table or View在某些情况下犹豫不决.不过,我一般喜欢使用LINQ,因为的普莱语法.我搜索过谷歌,但没有找到详细的问题.
我们考虑一下这段代码:
using (NorthwindEntities db = new NorthwindEntities())
{
var custs = from c in db.Customers where c.City == "London" select c;
var edus = from c in db.Educations where c.Education != "2" select c;
// ... and so on
}
Run Code Online (Sandbox Code Playgroud)
问题:
1.它是否为每个查询打开一个新连接?如果是,那么不建议单独使用上述查询?
2.另外,你能否告诉我有什么情况我必须使用存储过程而不是LINQ?