Stored procedures and functions with EF

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
acerdas
Posts: 2
Joined: Fri 22 Jan 2010 16:50

Stored procedures and functions with EF

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 26 Jan 2010 09:12

We have answered you by e-mail. Is the problem resolved?

tleese22
Posts: 8
Joined: Fri 19 Feb 2010 02:58

Post by 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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by 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.

Post Reply