linq 存储过程返回多个结果集
model 层
代码
[Function(Name = "dbo.selectTopInfoBySub_date")]
[ResultType(typeof(ShangYiTiao))] //关系映射
[ResultType(typeof(XiaYiTiao))]
public IMultipleResults selectTopInfoBySub_date([Parameter(DbType = "Int")] System.Nullable<int> id, [Parameter(DbType = "VarChar(50)")] string tableName, [Parameter(DbType = "Char(36)")] string userid, [Parameter(DbType = "Int")] ref System.Nullable<int> count)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), id, tableName, userid, count);
count = ((System.Nullable<int>)(result.GetParameterValue(3)));
return ((IMultipleResults)(result.ReturnValue));
}
调用
代码
Model newmodel = new Model();IMultipleResults upanddown = null;
upanddown = newmodel.selectTopInfoBySub_date(Convert.ToInt32(ViewData["ID"]), "express", Convert.ToString(list[0].userid), ref pcount);
List<ShangYiTiao> SYT = upanddown.GetResult<ShangYiTiao>().ToList();
List<XiaYiTiao> XYT = upanddown.GetResult<XiaYiTiao>().ToList();