Beispiel #1
0
        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));
                    }
                }
            }
        }
Beispiel #2
0
        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));
                }
            }
        }
Beispiel #3
0
        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));
                    }
                }
            }
        }
Beispiel #4
0
 public DbResultAdapter(ICollection <T> resultSet, Action <DbFieldMap <T> > resultMap)
 {
     _ResultSet = resultSet;
     _FieldMap  = new DbFieldMap <T>();
     _FieldMap.PrepareResultMap(resultMap);
 }