I have create a table and create edm开发者_开发问答x file, and I create a Stored Procedure that return a single row (select by primary key), and I want the edmx to have a function that calls that SP and return a type. How to do it, please help
Select the entity model in design mode. Right click, choose "add", choose "Function import". Now in the dialog you give the procedure a name and choose the procedure from the drop down.
However, if you already have the table in your entity model you can select a single row based on primary key quite easily:
var objectRepresentingSingleRow = yourDataContext.theTable.First(t => t.Id == someId);
精彩评论