LinqConnect generates return type of object for Oracle Table Functions
Posted: Tue 06 May 2014 03:50
We are updating some of our custom code to use Oracle instead of MSSQL. The code currently uses a DataContext class that was created by sqlmetal.exe to communicate with a MSSQL database.
I am trying to use LinqConnect to generate a new Datacontext. I am able to generate the Context classes but all of our table functions are being generated with a return type of System.Object instead of using IQueryable (http://www.devart.com/linqconnect/docs/ ... tions.html).
Here is an example of one of the functions we are using as well as the types:
CREATE OR REPLACE TYPE MYUSER.T_ORDERINFO IS OBJECT
(
CUSTEDP NUMBER(18,0),
COMPANY CHAR(2),
DIVISION CHAR(2)
);
CREATE OR REPLACE TYPE MYUSER.T_ORDERINFO_COLL IS TABLE OF T_ORDERINFO;
CREATE OR REPLACE FUNCTION MYUSER.spMYUSERGetOrderInfo (OrderNo_IN IN VARCHAR2)
RETURN T_ORDERINFO_COLL
IS
l_res_coll T_ORDERINFO_COLL;
custedp NUMBER(18,0);
co CHAR(2);
div CHAR(2);
BEGIN
l_res_coll := T_ORDERINFO_COLL();
BEGIN
SELECT SUBSTR(OX.XREFNO,3,9) INTO custedp
FROM PRODUCTION.ORDERXREF OX
WHERE OX.SEARCHTYPE = 'PY'
AND OX.FULLORDERNO = CONCAT(OrderNo_IN , '0000');
SELECT OH.COMPANY, OH.DIVISION INTO co, div
FROM PRODUCTION.ORDERHEADER OH
WHERE OH.FULLORDERNO = CONCAT(OrderNo_IN , '0000');
EXCEPTION
WHEN NO_DATA_FOUND THEN
SELECT OH.CUSTEDP, OH.COMPANY, OH.DIVISION INTO custedp, co, div
FROM PRODUCTION.ORDERHEADER OH
WHERE OH.FULLORDERNO = CONCAT(OrderNo_IN, '0000');
END;
l_res_coll.extend;
l_res_coll(1) := T_ORDERINFO(custedp, co, div);
RETURN l_res_coll;
END;
And here is a snippet of code from the Context.Designer.cs file that is generated by LinqConnect:
/// <summary>
/// There are no comments for SPMYUSERGETORDERINFO in the schema.
/// </summary>
[Function(Name=@"MYUSER.SPMYUSERGETORDERINFO", IsComposable=true)]
public System.Object SPMYUSERGETORDERINFO([Parameter(Name="ORDERNO_IN", DbType="VARCHAR2(4000 CHAR)")] string ORDERNO_IN)
{
IExecuteResult _SPMYUSERGETORDERINFOResult = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), ORDERNO_IN);
return ((System.Object)(_SPMYUSERGETORDERINFOResult.ReturnValue));
}
I also do not see the TYPES defined anywhere in the Context.Designer.cs class that is being generated.
Any advise would be appreciated.
I am trying to use LinqConnect to generate a new Datacontext. I am able to generate the Context classes but all of our table functions are being generated with a return type of System.Object instead of using IQueryable (http://www.devart.com/linqconnect/docs/ ... tions.html).
Here is an example of one of the functions we are using as well as the types:
CREATE OR REPLACE TYPE MYUSER.T_ORDERINFO IS OBJECT
(
CUSTEDP NUMBER(18,0),
COMPANY CHAR(2),
DIVISION CHAR(2)
);
CREATE OR REPLACE TYPE MYUSER.T_ORDERINFO_COLL IS TABLE OF T_ORDERINFO;
CREATE OR REPLACE FUNCTION MYUSER.spMYUSERGetOrderInfo (OrderNo_IN IN VARCHAR2)
RETURN T_ORDERINFO_COLL
IS
l_res_coll T_ORDERINFO_COLL;
custedp NUMBER(18,0);
co CHAR(2);
div CHAR(2);
BEGIN
l_res_coll := T_ORDERINFO_COLL();
BEGIN
SELECT SUBSTR(OX.XREFNO,3,9) INTO custedp
FROM PRODUCTION.ORDERXREF OX
WHERE OX.SEARCHTYPE = 'PY'
AND OX.FULLORDERNO = CONCAT(OrderNo_IN , '0000');
SELECT OH.COMPANY, OH.DIVISION INTO co, div
FROM PRODUCTION.ORDERHEADER OH
WHERE OH.FULLORDERNO = CONCAT(OrderNo_IN , '0000');
EXCEPTION
WHEN NO_DATA_FOUND THEN
SELECT OH.CUSTEDP, OH.COMPANY, OH.DIVISION INTO custedp, co, div
FROM PRODUCTION.ORDERHEADER OH
WHERE OH.FULLORDERNO = CONCAT(OrderNo_IN, '0000');
END;
l_res_coll.extend;
l_res_coll(1) := T_ORDERINFO(custedp, co, div);
RETURN l_res_coll;
END;
And here is a snippet of code from the Context.Designer.cs file that is generated by LinqConnect:
/// <summary>
/// There are no comments for SPMYUSERGETORDERINFO in the schema.
/// </summary>
[Function(Name=@"MYUSER.SPMYUSERGETORDERINFO", IsComposable=true)]
public System.Object SPMYUSERGETORDERINFO([Parameter(Name="ORDERNO_IN", DbType="VARCHAR2(4000 CHAR)")] string ORDERNO_IN)
{
IExecuteResult _SPMYUSERGETORDERINFOResult = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), ORDERNO_IN);
return ((System.Object)(_SPMYUSERGETORDERINFOResult.ReturnValue));
}
I also do not see the TYPES defined anywhere in the Context.Designer.cs class that is being generated.
Any advise would be appreciated.