I am looking for a way to call a stored procedure with Linq except do it asynchronously. Using the example from the Microsoft site.
[Function(Name="dbo.VariableResultShapes")]
[ResultType(typeof(VariableResultShapesResult1))]
[ResultType(typeof(VariableResultShapesResult2))]
public IMultipleResults VariableResultShapes([Parameter(DbType="Int")] System.Nullable<int> shape)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), shape);
return ((IMultipleResults)(result.ReturnValue));
}
I’m doing this similarly with other procs and using the ResultType Attributes to map my results from the call. However is there a way to call this in an asynchronous fashion. I can’t seem to find anything to that effect.
Why not just use the TPL. This would be simple, however you could look into the PLINQ methods. If TPL is ok, then you could do something like this (pseudo-ish):