Example #1
0
 public static ICollection <ConditionLite> Or(this ICollection <ConditionLite> filter, string fieldName, OperatorLite oper)
 {
     if (oper != OperatorLite.IsNotNull && oper != OperatorLite.IsNull)
     {
         throw new ArgumentException("El operador sólo puede ser IsNull o IsNotNull", "oper");
     }
     filter.Add(new ConditionLite
     {
         LogicalOperator = LogicalOperatorLite.Or,
         FieldName       = fieldName,
         Operator        = oper
     });
     return(filter);
 }
Example #2
0
 public static IQueryLite <TEntity> And <TEntity>(this IQueryLite <TEntity> query, string fieldName, OperatorLite oper)
 {
     return(query.Where(fieldName, oper));
 }
Example #3
0
        //public static IQueryLite<TEntity> And<TEntity, TProperty>(this IQueryLite<TEntity> query, Expression<Func<TEntity, TProperty>> selector, OperatorLite oper, TProperty fieldValue)
        //{
        //	return query.And(selector.GetMemberName(), oper, (object) fieldValue);
        //}

        public static IQueryLite <TEntity> And <TEntity>(this IQueryLite <TEntity> query, string fieldName, OperatorLite oper, object fieldValue, object param)
        {
            return(query.Where(fieldName, oper, fieldValue, param));
        }
Example #4
0
        //public static FilterLite<TEntity> And<TEntity, TProperty>(this FilterLite<TEntity> filter, Expression<Func<TEntity, TProperty>> selector, TProperty fieldValue) where TEntity : class, new()
        //{
        //	return (FilterLite<TEntity>)filter.And(selector.GetMemberName(), fieldValue);
        //}

        public static ICollection <ConditionLite> And(this ICollection <ConditionLite> filter, string fieldName, OperatorLite oper, object fieldValue)
        {
            return(filter.Where(fieldName, oper, fieldValue));
        }
Example #5
0
 public static IQueryLite <TEntity> Where <TEntity>(this IQueryLite <TEntity> query, string fieldName, OperatorLite oper, object fieldValue)
 {
     query.Filter.Where(fieldName, oper, fieldValue);
     return(query);
 }
Example #6
0
        //public static FilterLite<TEntity> Where<TEntity, TProperty>(this FilterLite<TEntity> filter, Expression<Func<TEntity, TProperty>> selector, TProperty fieldValue) where TEntity : class, new()
        //{
        //	return (FilterLite<TEntity>)filter.Where(selector.GetMemberName(), fieldValue);
        //}

        public static ICollection <ConditionLite> Where(this ICollection <ConditionLite> filter, string fieldName, OperatorLite oper, object fieldValue)
        {
            if (oper == OperatorLite.IsNotNull || oper == OperatorLite.IsNull || oper == OperatorLite.STDistanceLess || oper == OperatorLite.STDistanceLessOrEquals)
            {
                throw new ArgumentException("Binary operators only", "oper");
            }
            var subQuery = fieldValue as IQueryLite;

            filter.Add(new ConditionLite
            {
                LogicalOperator = LogicalOperatorLite.And,
                FieldName       = fieldName,
                Operator        = oper,
                FieldValue      = subQuery == null ? fieldValue : null,
                SubQuery        = subQuery
            });
            return(filter);
        }
Example #7
0
        //public static FilterLite<TEntity> Where<TEntity, TProperty>(this FilterLite<TEntity> filter, Expression<Func<TEntity, TProperty>> selector, OperatorLite oper, TProperty fieldValue) where TEntity : class, new()
        //{
        //	return (FilterLite<TEntity>)filter.Where(selector.GetMemberName(), oper, fieldValue);
        //}

        public static ICollection <ConditionLite> Where(this ICollection <ConditionLite> filter, string fieldName, OperatorLite oper, object fieldValue, object param)
        {
            if (oper != OperatorLite.STDistanceLess && oper != OperatorLite.STDistanceLessOrEquals)
            {
                throw new ArgumentException("Ternary operators only", "oper");
            }
            filter.Add(new ConditionLite
            {
                LogicalOperator = LogicalOperatorLite.And,
                FieldName       = fieldName,
                Operator        = oper,
                FieldValue      = fieldValue,
                Parameter       = param
            });
            return(filter);
        }
		public static IQueryLite<TEntity> Or<TEntity>(this IQueryLite<TEntity> query, string fieldName, OperatorLite oper, object fieldValue, object param)
		{
			if (query == null) throw new ArgumentNullException(nameof(query));
			query.Filter.Or(fieldName, oper, fieldValue, param);
			return query;
		}
		public static ICollection<ConditionLite> Where(this ICollection<ConditionLite> filter, string fieldName, OperatorLite oper)
		{
			if (filter == null) throw new ArgumentNullException(nameof(filter));
			if (fieldName == null) throw new ArgumentNullException(nameof(fieldName));
			if (oper != OperatorLite.IsNotNull && oper != OperatorLite.IsNull) throw new ArgumentException("El operador sólo puede ser IsNull o IsNotNull", nameof(oper));
			filter.Add(new ConditionLite
			{
				LogicalOperator = LogicalOperatorLite.And,
				FieldName = fieldName,
				Operator = oper
			});
			return filter;
		}
		public static ICollection<ConditionLite> Or(this ICollection<ConditionLite> filter, string fieldName, OperatorLite oper, object fieldValue, object param)
		{
			if (filter == null) throw new ArgumentNullException(nameof(filter));
			if (fieldName == null) throw new ArgumentNullException(nameof(fieldName));
			if (oper != OperatorLite.STDistanceLess && oper == OperatorLite.STDistanceLessOrEquals) throw new ArgumentException("Ternary operators only", nameof(oper));
			filter.Add(new ConditionLite()
			{
				LogicalOperator = LogicalOperatorLite.Or,
				FieldName = fieldName,
				Operator = oper,
				FieldValue = fieldValue,
				Parameter = param
			});
			return filter;
		}
		public static ICollection<ConditionLite> Or(this ICollection<ConditionLite> filter, string fieldName, OperatorLite oper, object fieldValue)
		{
			if (filter == null) throw new ArgumentNullException(nameof(filter));
			if (oper == OperatorLite.IsNotNull || oper == OperatorLite.IsNull) throw new ArgumentException("Binary operators only", nameof(oper));
			var subQuery = fieldValue as IQueryLite;
			filter.Add(new ConditionLite()
			{
				LogicalOperator = LogicalOperatorLite.Or,
				FieldName = fieldName,
				Operator = oper,
				FieldValue = subQuery == null ? fieldValue : null,
				SubQuery = subQuery
			});
			return filter;
		}
		public static IQueryLite<TEntity> Or<TEntity>(this IQueryLite<TEntity> query, string fieldName, OperatorLite oper)
		{
			if (query == null) throw new ArgumentNullException(nameof(query));
			if (oper != OperatorLite.IsNotNull && oper != OperatorLite.IsNull) throw new ArgumentException("El operador sólo puede ser IsNull o IsNotNull", nameof(oper));
			query.Filter.Or(fieldName, oper);
			return query;
		}
		public static IQueryLite<TEntity> Where<TEntity>(this IQueryLite<TEntity> query, string fieldName, OperatorLite oper)
		{
			if (query == null) throw new ArgumentNullException(nameof(query));
			if (fieldName == null) throw new ArgumentNullException(nameof(fieldName));
			query.Filter.Where(fieldName, oper);
			return query;
		}
		public static ICollection<ConditionLite> And(this ICollection<ConditionLite> filter, string fieldName, OperatorLite oper)
		{
			return filter.Where(fieldName, oper);
		}