Пример #1
0
        public bool TrySelectIds(Expression <Func <Selector <T>, Selector <T> > > expression, out List <int> result, out long total)
        {
            var t = ServiceProvider.GetService <T>();

            if (!FactoryIndexerHelper.Support(t) || !Indexer.CheckExist(t))
            {
                result = new List <int>();
                total  = 0;
                return(false);
            }

            try
            {
                result = Indexer.Select(expression, true, out total).Select(r => r.Id).ToList();
            }
            catch (Exception e)
            {
                Logger.Error("Select", e);
                total  = 0;
                result = new List <int>();
                return(false);
            }

            return(true);
        }
Пример #2
0
        public static bool TrySelect(Expression <Func <Selector <T>, Selector <T> > > expression, out IReadOnlyCollection <T> result)
        {
            if (!Support || !Indexer.CheckExist(new T()))
            {
                result = new List <T>();
                return(false);
            }

            try
            {
                result = Indexer.Select(expression);
            }
            catch (Exception e)
            {
                Logger.Error("Select", e);
                result = new List <T>();
                return(false);
            }
            return(true);
        }
Пример #3
0
        public static bool TrySelectIds(Expression <Func <Selector <T>, Selector <T> > > expression, out List <int> result)
        {
            if (!Support || !Indexer.CheckExist(new T()))
            {
                result = new List <int>();
                return(false);
            }

            try
            {
                result = Indexer.Select(expression, true).Select(r => r.Id).ToList();
            }
            catch (Exception e)
            {
                Logger.Error("Select", e);
                result = new List <int>();
                return(false);
            }

            return(true);
        }
Пример #4
0
        public bool TrySelect(Expression <Func <Selector <T>, Selector <T> > > expression, out IReadOnlyCollection <T> result)
        {
            var t = ServiceProvider.GetService <T>();

            if (!FactoryIndexerHelper.Support(t) || !Indexer.CheckExist(t))
            {
                result = new List <T>();
                return(false);
            }

            try
            {
                result = Indexer.Select(expression);
            }
            catch (Exception e)
            {
                Logger.Error("Select", e);
                result = new List <T>();
                return(false);
            }
            return(true);
        }