Example:
using log4net;
using System;
using System.Collections.Generic;
using Tridion.ContentDelivery.DynamicContent.Query;
namespace SDL.CIL.Test
{
internal static class Program
{
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
private static void Main(string[] args)
{
Query query = new Query();
List criteria = new List
{
new ItemSchemaCriteria(340),
new PublicationCriteria(8),
new ItemTemplateCriteria(350)
};
query.Criteria = CriteriaFactory.And(criteria.ToArray());
List artickecategoryQuery = new List();
CustomMetaValueCriteria nameCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("field-name1"), "value", Criteria.Equal);
artickecategoryQuery.Add(nameCriteria);
query.Criteria.AddCriteria(CriteriaFactory.Or(artickecategoryQuery.ToArray()));
CustomMetaValueCriteria authorCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("field-name2"), "value", Criteria.Equal);
artickecategoryQuery.Add(authorCriteria);
query.Criteria.AddCriteria(CriteriaFactory.Or(artickecategoryQuery.ToArray()));
string[] componentsUris = query.ExecuteQuery();
foreach(var itemId in componentsUris)
{
Console.WriteLine(itemId);
}
Console.WriteLine("Finished");
Log.Info("Finished");
Console.Read();
}
}
}