Stored procedures and functions with EF

Stored procedures and functions with EF

Postby acerdas » Fri 22 Jan 2010 16:55

Hello

We haven't been able to understand how you should call stored procedures or functions that return scalar values with Enttity Framework.

Whe have checked the article http://www.devart.com/blogs/dotconnect/?p=5 but it refers to stored procedures returning cursors not string (for example)

Can you help us by telling us which are the necesary steps to accomplish that?

Thanks
acerdas
 
Posts: 2
Joined: Fri 22 Jan 2010 16:50

Postby Shalex » Tue 26 Jan 2010 09:12

We have answered you by e-mail. Is the problem resolved?
Shalex
Devart Team
 
Posts: 7391
Joined: Thu 14 Aug 2008 12:44

Postby tleese22 » Mon 29 Mar 2010 23:11

Would like to see these answers in the posting so others can see the solution (like me) who has the same question.
tleese22
 
Posts: 8
Joined: Fri 19 Feb 2010 02:58

Postby Shalex » Tue 30 Mar 2010 08:16

If a stored procedure returns scalar value, it is necessary to adjust the settings of the method in Method Editor of Devart Entity Developer. Assuming your stored procedure looks like

Code: Select all
CREATE or REPLACE PROCEDURE GET_STRING(strParam OUT Varchar)
IS
BEGIN
select 'Hello!' into strparam from dual;
END;


Return Type in Method Editor should be set to None, and make sure that the Direction property of out parameter is set to Output in the Parameters tab. Save the model. You can call this method from your code now:

Code: Select all
string tmp = null;
using (DataSourceModel1.DataSourceModel1Entities context = new DataSourceModel1.DataSourceModel1Entities()){
    context.Get_String(ref tmp);
}


If you encounter any difficulties, please specify the exact error message and the steps we should follow to reproduce it in our environment.
Shalex
Devart Team
 
Posts: 7391
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle