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();
Copyright © IT之家(Www.IT55.Com) Powered By 易网科技 备案号:豫ICP备07012916号
本站QQ群:6614136 / 4218001 友情链接QQ:987950121