Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
We have create stored procedures and imported using entity framework.


For access result of stored procedure there is option to that to create model for each and every property of stored procedure result and mapping of model.


but is there any other option to directly access result of stored procedure without create model for each stored procedure.

What I have tried:

public dynamic GetCollection()
{
     var lstChkResult = _db.SPGetCollection().ToList();
     return lstChkResult;
}


we have tried it by using dynamic keyword ,but it do not support to check count of result.
Posted
Comments
F-ES Sitecore 27-Apr-18 5:06am    
Those classes are created for you so what is the issue with doing it that way?
Kinjal Sucess 27-Apr-18 6:19am    
there is one procedure with different result set. Entity framework only generate model for first result set. So can not add different result set in one procedure.

these way not allow to reuse of store procedure, for every request there will be different procedure, this is create redundant of code.
F-ES Sitecore 27-Apr-18 6:31am    
You can tell EF the type you want the result to map to if you want to re-use types rather than having it create new ones. It is one of the options when you're adding the SP to the context.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900