How can I map a select stored procedure to an entity in EF 3.5?
Maybe I'm missing something here... we are tryin开发者_运维技巧g 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.
精彩评论