Stored Procedure Parameter Mapping

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
m4tthall
Posts: 4
Joined: Tue 20 Jul 2010 14:56

Stored Procedure Parameter Mapping

Post by m4tthall » Mon 24 Jan 2011 14:39

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 26 Jan 2011 11:53

Thank you for the report, we have already found this problem.
We are investigating the problem, I will let you know about the results.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 28 Jan 2011 09:09

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.

m4tthall
Posts: 4
Joined: Tue 20 Jul 2010 14:56

Post by m4tthall » Mon 31 Jan 2011 09:08

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 31 Jan 2011 15:44

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 07 Feb 2011 11:21

The upcoming build will contain the new Result Set Mapping dialog allowing mapping the result set columns to the entity properties.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 11 Feb 2011 11:50

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.

Post Reply