摘要: 1、首先在数据库中创建好存储过程。 2、在实体模型中添加存储过程的映射。此时根据映射过来的查询结果有两种途径:第一种可以选择添加选择的存储过程的函数到实体模型中。这样的话,查询的结果将会是xxx_result类型。List results = db.GetTestsString("2").ToList(); foreach (var result in results ) { Console.WriteLine(result .Id);}其中,GetTestsString_Result为EF自己生成的映射model,GetTestsString为存储过程名。第二种不选择添加 阅读全文
posted @ 2014-01-16 14:41 瓜王 阅读(577) 评论(0) 推荐(0)
摘要: 本文资料来源:http://www.codeproject.com/Articles/246861/LINQ-to-Entities-Basic-Concepts-and-Features)LINQ to Entities needs an Object Context object. The ObjectContext object is the bridge between LINQ and the database (we will explain more about ObjectContext later). LINQ to Objects don't need any in 阅读全文
posted @ 2014-01-16 14:23 瓜王 阅读(2958) 评论(0) 推荐(2)