I have a Oracle db and some storeprocedures and the call to these is executed as select package.myFunction(param) from dual.
Since i sometimes call lots of functions in the code i would find it useful to be able to call function at the same time.
var param = (from d in contex.dual
select new { result1 = context.myFunction(param), result2 = context.myFunction2() });
This way I don't need to make the same amount of database call in a time critical area.
I'm guessing this can be achieved in some way, but dual does not exist in context...
Calling multiple functions in context
Try the following code:
Code: Select all
var param = new { result1 = context.myFunction(param), result2 = context.myFunction2() };
Try this code, it worked for me.
Code: Select all
var q = from d in db.Query("dual")
select new
{
result1 = db.GetTest1(0),
result2 = db.GetTest2(0)
};
Don't work for me.
In the output i get this
This is my code (Linq to Sql did not have any context.Query so I guessed that that equals ExecuteQuery
[/code]
In the output i get this
Code: Select all
dual
SELECT jfp.jfp_order.get_order_value1(:p0) AS C1 FROM DUAL
ParameterName = p0
DbType = Decimal
Value = 1021
SELECT jfp.jfp_order.get_order_value2(:p0) AS C1 FROM DUAL
ParameterName = p0
DbType = Decimal
Value = 1021
A first chance exception of type 'Devart.Data.Oracle.OracleException' occurred in Devart.Data.dll
Code: Select all
var p = (from d in context.ExecuteQuery("dual")
select new
{
result1 = context.GetFirst(param1),
result2= context.GetSecond(param2)
}).First();