Exemplo n.º 1
0
        public List <T> Select(IEnumerable <object> ids)
        {
            DataTableColumn column = _columns.First(x => x.PrimaryKey);
            string          query  = QueryBuilder.SelectQuery(TableName, column.ColumnName, ids);
            List <T>        items  = LoadItems(query);

            return(items);
        }
Exemplo n.º 2
0
        private static DataTableColumn[] ExtractDataColumns()
        {
            List <DataTableColumn> columns = new List <DataTableColumn>();

            PropertyInfo[] properties = typeof(T).GetProperties();
            foreach (PropertyInfo property in properties)
            {
                DataTableColumnAttribute attribute = property.GetCustomAttribute <DataTableColumnAttribute>();
                if (attribute != null)
                {
                    DataTableColumn column = new DataTableColumn(attribute, property);
                    columns.Add(column);
                }
            }
            return(columns.ToArray());
        }