public CompositeParameter CreateComposite(string resource, string key, IEnumerable <string> values)
        {
            CompositeParameter composite = new CompositeParameter();

            composite.Logic = Logic.Or;
            //List<IParameter> parameters = new List<IParameter>();
            foreach (string value in values)
            {
                if (!string.IsNullOrEmpty(value))
                {
                    IParameter p = CreateParameter(resource, key, value);
                    composite.parameters.Add(p as Parameter);
                }
            }
            return(composite);
        }
Exemple #2
0
        public static IMongoQuery BuildQuery(this CompositeParameter parameter)
        {
            List <IMongoQuery> queries = new List <IMongoQuery>();

            foreach (Parameter p in parameter.parameters)
            {
                IMongoQuery q = p.ToQuery();
                queries.Add(q);
            }
            if (parameter.Logic == Logic.And)
            {
                return(Query.And(queries));
            }
            else
            {
                return(Query.Or(queries));
            }
        }
Exemple #3
0
 public CompositeParameter CreateComposite(string resource, string key, IEnumerable<string> values)
 {
     CompositeParameter composite = new CompositeParameter();
     composite.Logic = Logic.Or;
     //List<IParameter> parameters = new List<IParameter>();
     foreach (string value in values)
     {
         if (!string.IsNullOrEmpty(value))
         {
             IParameter p = CreateParameter(resource, key, value);
             composite.parameters.Add(p as Parameter);
         }
     }
     return composite;
 }