I've had some problems related to using oracle stored procs with multiple output parameters. I was wondering if I'm doing something wrong, or if these are genuine bugs (I'm using version 4.2)
1. "An item with the same key has already been added"
I created an Emp and Dept class mapping back to corresponding emp and dept tables, then created a get_dept_and_emp sproc that opens two out refcursors and selects the entire dept and emp table contents into the two respective refcursors (it doesn't matter what the columns are):
Code: Select all
PROCEDURE GET_DEPT_AND_EMP(P_OUT_EMP_CUR out SYS_REFCURSOR, P_OUT_DEPT_CUR out SYS_REFCURSOR) is BEGIN open p_out_emp_cur for select * from emp; open p_out_dept_cur for select * from DEPT; end;
On every subsequent save / close / reopen of the model, I get an error stating "An item with the same key has already been added" and a line number. When I go to that line in the XML, I see that duplicate EntitySet and ReturnType attributes have been added, with one pair having the devart: namespace prefix:
Code: Select all
<FunctionImport Name="GET_DEPT_AND_EMP" EntitySet="EMPs" ReturnType="Collection(Model.EMP)" devart:EntitySet="EMPs;DEPTs" devart:ReturnType="Collection(Model.EMP);Collection(Model.DEPT)" ...
2. "Model.X does not contain a definition for 'EntityKey and no extension method..."
If I then select and enable the POCO Entity Class, the project will not build, raising errors relating to the entity key property not being found on EMP or DEPT (and also: The best overloaded method match for 'System.Data.Objects.ObjectContext.Attach(System.Data.Objects.DataClasses.IEntityWithKey)' has some invalid arguments). Somehow, the templating code sees these POCOs and treats them as entity classes because they are attached to some kind of multiple result set object.
3. "The data reader is incompatible with the specified 'Model.DEPT'"
Using a similar sproc with only one out refcursor for DEPT, if I change the name of a dept property (dept_name to deptname) but leave the column mapping unchanged (dept_name), and then try to call the sproc in my code, it throws this error: "The data reader is incompatible with the specified 'Model.DEPT'. A member of the type, 'DEPTNAME', does not have a corresponding column in the data reader with the same name." I don't have the same problem where there are multiple out refcursors, though, (in the case of Entity objects, seeing as it won't compile if I try this using the POCO template).
Are these genuine bugs / limitations, or am I just doing something wrong or missing a setting somewhere? I'm currently researching dotconnect in order to work out whether it's suitable for my department to use as a DAL for future projects, so any assistance would be very much appreciated.