简体   繁体   English

如何将选择的存储过程映射到EF 3.5中的实体?

[英]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.

相关问题 将存储过程映射到ef5中的实体 - map a stored procedure to a entity in ef5 是否可以将存储过程列映射回EF4中的实体? - Is it possible to map a stored procedure column back to an entity in EF4? 如何使用与Entity Framework一起使用表的存储过程 - How can I use a stored procedure that uses tables with Entity Framework 如何使用Entity Framework加载存储过程的结果? - How can I use Entity Framework to load the results of a stored procedure? 如何启动EF6异步中的实体存储过程而不等待返回? - How do I kick off an entity stored procedure in EF6 async and not wait for a return? 如何在实体框架中检查存储过程的返回值 - how can i check return value of stored procedure in entity framework 如何在Entity Framework 6代码优先方法中MAP选择存储过程? - How to MAP select stored procedure in Entity Framework 6 code-first approach? 如何在EF4中为SELECT调用存储过程以填充EntityDataSource - How to call a stored Procedure for SELECT in EF4 to populate an EntityDataSource EF Core查询存储过程映射到类型 - EF Core query stored procedure map to types 如何防止与EF并发执行SQL Server存储过程? - How can i prevent concurrent execution of SQL Server stored procedure with EF?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM