public async Task <IMultipleResult> InitDataAsync(RequestContext requestContext, IDataReaderWrapper dataReaderWrapper, IDataReaderDeserializer dataReaderDeserializer) { foreach (var resultMapKV in _resultDataMap) { var resultMap = resultMapKV.Value; switch (resultMap.Type) { case ResultMap.ResultTypeType.Single: { resultMap.Result = await dataReaderDeserializer.ToSingleAsync(requestContext, dataReaderWrapper, resultMap.ResultType, false); break; } case ResultMap.ResultTypeType.Enumerable: { resultMap.Result = await dataReaderDeserializer.ToEnumerableAsync(requestContext, dataReaderWrapper, resultMap.ResultType, false); break; } } await dataReaderWrapper.NextResultAsync(); } return(this); }
public async Task <T> QuerySingleAsync <T>(RequestContext context) { return(await ExecuteWrapAsync(async (dbSession) => { var dataReader = await CommandExecuter.ExecuteReaderAsync(dbSession, context); return await _dataReaderDeserializer.ToSingleAsync <T>(context, dataReader); }, context, DataSourceChoice.Read)); }