简体   繁体   中英

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.

Everything we do in our organization is required to be in a stored procedure so the DBA's can have a feeling of control. 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.

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM