public static string SerialiseMetadataQueryExpression(MetadataQueryExpression item)
 {
     if (item != null)
     {
         string xml =
             @"<c:Criteria>"
             + MetadataSerialiser.SerialiseMetadataFilterExpression(item.Criteria) +
             @"</c:Criteria>
             <c:Properties>"
             + MetadataSerialiser.SerialiseMetadataPropertiesExpression(item.Properties)
             + @" </c:Properties>";
         return(xml);
     }
     return("");
 }
Пример #2
0
        public static void AddFilter(this MetadataQueryExpression query, MetadataFilterExpression filter)
        {
            if (filter == null)
            {
                return;
            }

            if (query.Criteria == null || query.Criteria.Conditions.Count == 0 && query.Criteria.Filters.Count == 0)
            {
                query.Criteria = filter;
            }
            else if (query.Criteria.FilterOperator == LogicalOperator.And)
            {
                query.Criteria.Filters.Add(filter);
            }
            else
            {
                query.Criteria = new MetadataFilterExpression {
                    Filters = { query.Criteria, filter }
                }
            };
        }
    }