Implementing a LINQ stored procedure returns multiple result sets

Source: Internet
Author: User
Tags datetime

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));
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.