private IList <EntityDTO> GetEntitiesList(DbConnection connection, string whereStatment, uint forId) { string sql = PreparedSqlSelect + whereStatment; DbCommand cmd = connection.CreateCommand(); var resultList = new List <EntityDTO> (); cmd.CommandText = sql; logger.Debug("Запрос объектов по SQL={0}", cmd.CommandText); InternalHelper.AddParameterWithId(cmd, forId); using (DbDataReader rdr = cmd.ExecuteReader()) { int IndexOfIdParam = rdr.GetOrdinal("id"); while (rdr.Read()) { object[] fields = new object[rdr.FieldCount]; rdr.GetValues(fields); resultList.Add(new EntityDTO { Id = (uint)fields[IndexOfIdParam], ClassType = ObjectClass, Title = String.Format(DisplayString, fields) }); } } return(resultList); }