Have been bothered by the return of multiple results from a LINQ stored procedure, overtime tonight, problem solving, sharing ideas:
LINQ stored procedures generated by default code is Isingleresult, that is, can only return a result set, we first move the hands, change it to imultipleresults. Entity classes are changed according to different circumstances.
Before the LINQ stored procedure changes:
[Function(Name="dbo.MeterTaskStat")]
public ISingleResult<XXXX> MeterTaskStat
([Parameter(Name="MeterTaskType", DbType="Int")]
System.Nullable<int> meterTaskType,
[Parameter(Name="StartDate", DbType="DateTime")]
System.Nullable<System.DateTime> startDate,
[Parameter(Name="EndDate", DbType="DateTime")]
System.Nullable<System.DateTime> endDate)
{
IExecuteResult result =
this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())),
meterTaskType, startDate, endDate);
return ((ISingleResult<XXXXXX>)(result.ReturnValue));
}
After the LINQ stored procedure has changed:
[Function(Name="dbo.MeterTaskStat")]
[ResultType(typeof(TaskStatData))]
public IMultipleResults MeterTaskStat
([Parameter(Name = "MeterTaskType", DbType = "Int")]
System.Nullable<int> meterTaskType,
[Parameter(Name = "StartDate", DbType = "DateTime")]
System.Nullable startDate,
[Parameter(Name = "EndDate", DbType = "DateTime")]
System.Nullable endDate)
{
IExecuteResult result =
this.ExecuteMethodCall
(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())),
meterTaskType, startDate, endDate);
return ((IMultipleResults)(result.ReturnValue));
}