Exemplo n.º 1
0
        private IQuery <T> QueryiSearch(string propertyName, string queryVal)
        {
            string tempQueryFiled = string.Empty;

            while (tempQueryFiled != queryVal)
            {
                tempQueryFiled = queryVal;
                queryVal       = queryVal.Replace("+ ", "+").Replace(" +", "+");
            }
            var query_Search = QueryFactory.Create <T>();

            string[] lst = queryVal.Split(new string[] { " ", "	", " ", "	"}, StringSplitOptions.RemoveEmptyEntries);
            foreach (var f in lst)
            {
                if (string.IsNullOrWhiteSpace(f))
                {
                    continue;
                }
                var      q = QueryFactory.Create <T>();
                string[] lstInfo;
                if (f.Contains("+") || f.Contains("+"))
                {
                    lstInfo = f.Split(new string[] { "+", "+" }, StringSplitOptions.RemoveEmptyEntries);
                }
                else
                {
                    lstInfo = new string[] { f };
                }
                foreach (var info in lstInfo)
                {
                    if (!string.IsNullOrWhiteSpace(info))
                    {
                        q.And(DBTool.GetContains <T>(propertyName, info));
                    }
                }
                query_Search.Or(q);
            }
            return(And(query_Search));
        }
Exemplo n.º 2
0
        public List <T> GetList()
        {
            var query = QueryFactory.Create <T>();

            return(GetList(query));
        }
Exemplo n.º 3
0
        public List <T> GetList(Expression <Func <T, bool> > predicate)
        {
            var query = QueryFactory.Create(predicate);

            return(GetList(query));
        }
Exemplo n.º 4
0
 public int Update(T obj, Expression <Func <T, bool> > predicate)
 {
     var where = QueryFactory.Create(predicate);
     return(Update(obj, where));
 }
Exemplo n.º 5
0
        public long Count(Expression <Func <T, bool> > predicate)
        {
            var query = QueryFactory.Create(predicate);

            return(Count(query));
        }
Exemplo n.º 6
0
 public int Delete(Expression <Func <T, bool> > predicate)
 {
     var where = QueryFactory.Create(predicate);
     return(Delete(where));
 }