Page 1 of 1

Stored Procedure Parameter Mapping

Posted: Mon 24 Jan 2011 14:39
by m4tthall
I have a stored procedure such as the following:

PROCEDURE JustTesting(curParam OUT SYS_REFCURSOR) AS
BEGIN
OPEN curParam FOR
SELECT *
FROM MyTable;
END JustTesting;

I have followed the instructions as outlined here: http://www.devart.com/dotconnect/oracle ... rsors.html

I have used the ADO.NET POCO Entity Generator to provide the model and context templates and generated the relevant classes.

The context now contains the following method relating to my function:

public ObjectResult JustTesting()
{
return base.ExecuteFunction("JustTesting");
}

Calling this method raises an error such as: "The data reader is incompatible with the specified MyModel.JustTestingResult'. A member of the type, 'MyTestId', does not have a corresponding column in the data reader with the same name."

Now, the reason for this is that the column in the database is named "My_Test_Id" not MyTestId. So, I can rename this in the JustTestingResult complex type (and this will work), but then why should my conceptual model have to be tightly coupled with the physical model? So, the question is, how do I map between MyTestId and My_Test_Id?

Thanks

Posted: Wed 26 Jan 2011 11:53
by AndreyR
Thank you for the report, we have already found this problem.
We are investigating the problem, I will let you know about the results.

Posted: Fri 28 Jan 2011 09:09
by AndreyR
This problem is caused by Entity Framework code.
You can find the reason in the note to this article:
For a function import to return an EntityType, the columns returned by the corresponding stored procedure must exactly match the scalar properties of the returned EntityType.
The solution is to leave underscores in the model or to create correct aliases in the procedure code.

Posted: Mon 31 Jan 2011 09:08
by m4tthall
AndreyR wrote:This problem is caused by Entity Framework code.
You can find the reason in the note to this article:
For a function import to return an EntityType, the columns returned by the corresponding stored procedure must exactly match the scalar properties of the returned EntityType.
The solution is to leave underscores in the model or to create correct aliases in the procedure code.
Thanks for the response. I assume you are dependant on EF then and can't incorporate something your side that can rectify this?

Thanks again

Posted: Mon 31 Jan 2011 15:44
by AndreyR
We will investigate the possibility to find a solution for this problem.
However, I'm not able to provide you a definite timeframe for this functionality to be implemented.

Posted: Mon 07 Feb 2011 11:21
by AndreyR
The upcoming build will contain the new Result Set Mapping dialog allowing mapping the result set columns to the entity properties.

Posted: Fri 11 Feb 2011 11:50
by AndreyR
We have released a new build with the Result Set Mapping support yesterday. This build can be downloaded from the Download page (the trial version) or from Registered Users' Area (for users with active subscription only).
For the detailed information about the fixes and improvements available in dotConnect for Oracle 6.10.103, please refer to this post.