[英]How can I map a select stored procedure to an entity in EF 3.5?
Maybe I'm missing something here... we are trying to adopt a framework for data access and have been exploring EF3.5. 也许我在这里遗漏了一些东西......我们正在尝试采用数据访问框架,并一直在探索EF3.5。
Everything we do in our organization is required to be in a stored procedure so the DBA's can have a feeling of control. 我们在组织中所做的一切都需要在存储过程中,因此DBA可以有一种控制感。 If I generate my entities from my database schema, I see how to map stored procedures to the update/insert/delete commands of an entity, but there is no mapping for the retrieval of the data.
如果我从数据库模式生成实体,我将看到如何将存储过程映射到实体的update / insert / delete命令,但是没有用于检索数据的映射。
Is this always internal to the framework, or can we somehow map our retrieval procedures to their respective entities? 这总是内部框架,还是我们可以以某种方式将我们的检索程序映射到它们各自的实体? If it is internal, is it possible to view/modify the generated sql?
如果是内部的,是否可以查看/修改生成的sql?
Thanks in advance for your help. 在此先感谢您的帮助。
When creating a model you are able to add a stored procedure to it. 创建模型时,您可以向其添加存储过程。
In case these stored procedures are returning collections of Entity types they can be added to the model. 如果这些存储过程返回实体类型的集合,则可以将它们添加到模型中。
Open the model in designer, right-click on the procedure and select the "Create Function Import" option. 在设计器中打开模型,右键单击该过程并选择“创建函数导入”选项。 Specify the correct return type, and you'll get a method retreiving entities.
指定正确的返回类型,您将获得一个方法retreiving实体。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.