Exemplo n.º 1
0
        protected override IEnumerable <Entity> GetEntities()
        {
            using (var conn = new SqlConnection(ConnString))
            {
                SqlDataReader reader = SqlUtil.ExecuteReader_Reader(Query, conn, Parameters);

                while (reader.Read())
                {
                    var entity = new Entity();
                    for (int i = 0; i < reader.FieldCount; ++i)
                    {
                        string columnName = reader.GetName(i);
                        entity.SetValue(columnName, reader.GetValue(i));
                    }

                    yield return(entity);
                }
            }
        }