public override IList GetObjectsOfType(Type type, Filter filter)
        {
            if (filter.FilterItems.Count < 1)
                return GetObjectsOfType(type);

            NPathQuery query = new NPathQuery();

            query.PrimaryType = type;

            string npathString = "Select * From " + GetTypeNameFromType(type) + " Where ";
            foreach (FilterItem item in filter.FilterItems)
            {
                npathString += item.PropertyName;
                switch (item.MatchCondition)
                {
                    case MatchCondition.Equals:
                        npathString += " = ";
                        break;
                    case MatchCondition.Like:
                        npathString += " LIKE ";
                        item.Value = "%" + item.Value + "%";
                        break;
                    case MatchCondition.LargerThan:
                        npathString += " > ";
                        break;
                    case MatchCondition.SmallerThan:
                        npathString += " < ";
                        break;
                }
                npathString += "? And ";

                query.Parameters.Add(item.Value);
            }
            npathString = npathString.Substring(0, npathString.Length - 4);

            query.Query = npathString;

            return context.GetObjectsByNPath(query);
        }
 public abstract IList GetObjectsOfType(Type type, Filter filter);
Exemplo n.º 3
0
 public IList GetObjectsOfType(Type type, Filter filter)
 {
     if (this.domainController != null)
         return this.domainController.GetObjectsOfType(type, filter);
     return new ArrayList();
 }