CreateObjectSet方法需要使用存储过程 [英] CreateObjectSet method needs to use Stored Procedure
本文介绍了CreateObjectSet方法需要使用存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
开始调查EF4作为我们新项目的可行框架(取代"数据集")。
1.    我们有严格的开发政策,只能访问db通过存储过程。所以EF4似乎处理这个好,但是在ObjectContext实体类的ObjectSet访问器属性中行(例如)
Products = CreateObjectSet< Product>(" Products") );
对db执行TSQL。我需要这个能够执行存储过程。
executes TSQL against the db. I need this to be able to execute a stored procedure.
这可能吗?任何帮助都表示赞赏。
推荐答案
虽然这不是直截了当的(你可以用一个在执行sproc的SSDL中定义Query元素,你当然可以在返回Products的集合的模型中创建一个Function Import。
While this is not straightforward to do (you may be able to do it with a DefiningQuery element in the SSDL that execs your sproc), you can certainly create a Function Import in the model that returns a collection of Products.
这篇关于CreateObjectSet方法需要使用存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文