示例#1
0
 public List <T> Select <T>(ISelectQuery aQuery, OnEntitySelect <T> onExecute) where T : class, new()
 {
     if (aQuery == null)
     {
         aQuery = QueryFactory.CreateSelectQuery <T>();
     }
     return(Select <T>(aQuery, new TemplateBinder <T>(), onExecute));
 }
示例#2
0
        public List <T> Get <T>(SqlCriteria aCriteria = null, OnEntitySelect <T> onExecute = null, CachePreference aPreferences = null) where T : class, new()
        {
            if (aCriteria == null)
            {
                aCriteria = Factory.CreateCriteria();
            }

            return(Select <T>(GetQuery <T>(aPreferences).SetCriteria(aCriteria), new TemplateBinder <T>(), onExecute));
        }
示例#3
0
        public virtual List <T> ExecuteSelectQuery(ISelectQuery aQuery, OnEntitySelect <T> onSelect)
        {
            List <T> list = null;

            DBHelper.Execute(
                delegate(DbSession aSession)
            {
                list = aSession.Select <T>(aQuery, onSelect);
            });
            return(list);
        }
示例#4
0
        private List <T> Select <T>(ISelectQuery aQuery, ResultBinder <T> aBinder, OnEntitySelect <T> onExecute) where T : class, new()
        {
            List <T> dataList = new List <T>();
            int      i        = 0;

            aBinder.OnBind =
                delegate(T anEntity)
            {
                dataList.Add(anEntity);
                if (onExecute != null)
                {
                    onExecute(anEntity, i);
                    i++;
                }
            };
            Connetion.execute(aQuery, aBinder);
            return(dataList);
        }
示例#5
0
 public virtual List <T> GetPager <E>(int aMinimum = 0, int aMaximum = 10, T aCriteriaModel = null, System.Linq.Expressions.Expression <Func <T, E> > aOrderBy = null, bool isAscending = true, String aSqlQuery = null, CachePreference aCachePreferences = null, OnEntitySelect <T> onSelect = null)
 {
     return(ExecuteSelectQuery(GetModelOrderQueryWithSql(aCriteriaModel, aOrderBy, isAscending, aSqlQuery, aCachePreferences).SetMaximum(aMaximum).SetMinimum(aMinimum), onSelect));
 }
示例#6
0
 public virtual List <T> Get <E>(T aCriteriaModel = null, System.Linq.Expressions.Expression <Func <T, E> > aOrderBy = null, bool isAscending = true, CachePreference aCachePreferences = null, OnEntitySelect <T> onSelect = null)
 {
     return(ExecuteSelectQuery(GetModelOrderQueryWithSql(aCriteriaModel, aOrderBy, isAscending, null, aCachePreferences), onSelect));
 }
示例#7
0
        public virtual List <T> Get(SqlCriteria aCriteria = null, CachePreference aCachePreferences = null, OnEntitySelect <T> onSelect = null)
        {
            if (aCriteria == null)
            {
                aCriteria = GetCriteria();
            }

            return(ExecuteSelectQuery(GetQuery(aCachePreferences).SetCriteria(aCriteria), onSelect));
        }