我的代码如下
try
{
SqlConnection mapperConnection = SqlAccessHelper.SqlHelper.GetOpenConnection(SqlConnectionHelper.SqlConnectionString());
var parameters = new DynamicParameters();
parameters.Add("@P_MarketId", marketId, DbType.Int32);
parameters.Add("@P_Output", dbType: DbType.Int32, direction: ParameterDirection.Output);
using (var multi = mapperConnection.QueryMultiple("USP_FetchMarketRecords", parameters, (SqlTransaction)null, 1000000, CommandType.StoredProcedure))
{
IEnumerable<MarketRecord.FItem> FItem = multi.Read<MarketRecord.FItem>();
IEnumerable<MarketRecord.FSubsystem> FSubsystem = multi.Read<MarketRecord.FSubsystem>();
objCResponseVO.addObject("FItem",FItem);
objCResponseVO.addObject("FSubsystem",FSubsystem);
}
}
catch (Exception ex) {
throw ex;
}
初读没问题。FSubsystem 的第二次阅读给了我一个例外“每个网格只能迭代一次”。这里有什么问题?当我在第二次读取时在公共 IEnumerable Read() 方法中追踪它时,消耗的属性为 true 。我怎样才能克服这个。?