How to Execute Ref Cursor Proc in Oracle via EF
Posted: Wed 24 Jun 2009 14:55
I have a Proc:
I added it to the EF Model as a Function, and it generated this code:
And I created a Unit Test to execute the proc and return the results.
What should the GetConfirmDocument() call pass in as the second parameter? It doesn't like the null. I get an error: System.InvalidOperationException: The parameter at index 1 in the parameters array is null.
Thanks.
Code: Select all
PROCEDURE Get_Confirm_Document(
DealID IN deal.DEAL_ID%TYPE,
r_cursor OUT sys_refcursor
)
ISCode: Select all
public global::System.Data.Objects.ObjectResult GetConfirmDocument(global::System.Nullable dEALID, global::System.Data.Objects.ObjectParameter r_CURSOR)
{
global::System.Data.Objects.ObjectParameter dEALIDParameter;
if (dEALID.HasValue)
{
dEALIDParameter = new global::System.Data.Objects.ObjectParameter("DEALID", dEALID);
}
else
{
dEALIDParameter = new global::System.Data.Objects.ObjectParameter("DEALID", typeof(long));
}
return base.ExecuteFunction("GetConfirmDocument", dEALIDParameter, r_CURSOR);
}
Code: Select all
[TestMethod]
public void MainPdfProcTest()
{
var context = new ServerModelEF.GcsModelEntities();
var result = context.GetConfirmDocument((long?)7623, null);
Assert.IsNotNull(result);
}Thanks.