1
ideablade의 술어 설명에서 Where 절에 여러 Or 및 And 연산을 어떻게 추가 할 수 있습니까? 예. 내가 CompositePredicateDescription
에 추가 또는 운영자에게 시도하지만 Ideablade를 사용하여 Where And 절을 여러 개 추가하는 방법 술어 설명
List <PredicateDescription> pdList = new List<PredicateDescription>();
Dictionary< int, List< PredicateDescription>> pdDateList = new Dictionary< int, List< PredicateDescription>>();
var pds = pdList.ToArray();
if (((pds.Length > 0) || (pdDateList.Count > 0)))
{
CompositePredicateDescription predicate = null;
if (pds.Length > 0)
{
predicate = PredicateBuilder.And(pds);
}
List<PredicateDescription> AndList = null;
CompositePredicateDescription compositePredicateDescription = null;
for (int i = 0; i < pdDateList.Count; i++)
{
List<PredicateDescription> pdlist1 = pdDateList[i];
AndList = new List<PredicateDescription>();
foreach (PredicateDescription pdesc in pdlist1)
{
AndList.Add(pdesc);
}
if (AndList.Count > 0)
{
if (predicate != null)
{
if (AndList.Count == 2)
{
predicate.Or(AndList[0].And(AndList[1]));
}
else if (AndList.Count == 1)
{
predicate.Or(AndList[0]);
}
}
}
}
}
if (predicate == null)
{
predicate = compositePredicateDescription;
}
var filterQuery = query.Where(predicate);
data = Globals.sLDManager.ExecuteQuery(filterQuery);
내가 쿼리 다음 실행하려면 - 나는 쿼리 위에 실행할 수있는
Select * from Tabel1 where t.field1=1 and t.field2=1 and t.field3=1 Or (t.field4=1 and t.field5=1) Or (t.field6=1 and t.field7=1)
ideablade를 사용합니다.
답장을 보내 주셔서 감사합니다. 위와 같은 코드도 구현했습니다. 그것은 나를 위해 작동합니다. – user1782872