public void ExecuteReader <T>(string commandText, int commandTimeout, CommandType commandType, Action <DbParameterBuilder> parametersBuilder, Action <DbFieldMap <T> > resultMap, Action <T> readEntity) where T : new() { using (DbDataReader reader = CreateReader(commandText, commandTimeout, commandType, parametersBuilder)) { if (readEntity != null) { DbFieldMap <T> map = new DbFieldMap <T>(); if (resultMap == null) { map.AddAllPropertiesOrFields(); } else { resultMap(map); } while (reader.Read()) { readEntity(map.ReadNew(reader)); } } } }
public IEnumerable <T> ExecuteReader <T>(string commandText, int commandTimeout, CommandType commandType, Action <DbParameterBuilder> parametersBuilder, Action <DbFieldMap <T> > resultMap = null) where T : class, new() { using (DbDataReader reader = CreateReader(commandText, commandTimeout, commandType, parametersBuilder)) { DbFieldMap <T> map = new DbFieldMap <T>(); map.PrepareResultMap(resultMap); while (reader.Read()) { yield return(map.ReadNew(reader)); } } }
public void ExecuteReader <T>(string commandText, int commandTimeout, CommandType commandType, Action <DbParameterBuilder> parametersBuilder, Action <DbFieldMap <T> > resultMap, Action <T> readEntity) where T : class, new() { using (DbDataReader reader = CreateReader(commandText, commandTimeout, commandType, parametersBuilder)) { if (readEntity != null) { DbFieldMap <T> map = new DbFieldMap <T>(); map.PrepareResultMap(resultMap); while (reader.Read()) { readEntity(map.ReadNew(reader)); } } } }