예제 #1
0
        public IEnumerable <T> GetSetCol <T>(DbConnection connection, Action <ColSelect <T> > ColSelector, object predicate, IList <ISort> sort, int firstResult, int maxResults, DbTransaction transaction, int?commandTimeout, bool buffered) where T : Cissy.Database.IEntity
        {
            IClassMapper classMap = SqlGenerator.Configuration.GetMap <T>();

            if (ColSelector.IsNotNull())
            {
                ColSelect <T> ColSelect = new ColSelect <T>();
                ColSelector(ColSelect);
                if (ColSelect.Cols.Any())
                {
                    foreach (IPropertyMap map in classMap.Properties)
                    {
                        map.Ignored = !ColSelect.Cols.Contains(map.Name);
                    }
                }
            }
            IPredicate wherePredicate = GetPredicate(classMap, predicate);

            return(GetSet <T>(connection, classMap, wherePredicate, sort, firstResult, maxResults, transaction, commandTimeout, buffered));
        }
예제 #2
0
        public IEnumerable <T> GetListColInIds <T, K>(DbConnection connection, Action <ColSelect <T> > ColSelector, string propertyName, IEnumerable <K> Ids, IList <ISort> sort, DbTransaction transaction, int?commandTimeout, bool buffered) where T : Cissy.Database.IEntity
        {
            IClassMapper classMap = SqlGenerator.Configuration.GetMap <T>();

            if (ColSelector.IsNotNull())
            {
                ColSelect <T> ColSelect = new ColSelect <T>();
                ColSelector(ColSelect);
                if (ColSelect.Cols.Any())
                {
                    foreach (IPropertyMap map in classMap.Properties)
                    {
                        map.Ignored = !ColSelect.Cols.Contains(map.Name);
                    }
                }
            }
            IPredicate wherePredicate = GetEntityPredicateInIds <K>(classMap, propertyName, Ids);

            return(GetList <T>(connection, classMap, wherePredicate, sort, transaction, commandTimeout, true));
        }