MongoDb
으로 작업 중이며 PredicateBuilder
클래스를 사용하여 where 절을 동적으로 C#으로 만듭니다. 그러나 예외가 생성됩니다 같은 :MongoDb C# 쿼리, where
[System.ArgumentException] { "지원되지 않는 where 절 :."},
및 동적 절은 사용
{c => (True AndAlso Invoke(c => (c.ID == value(ASP.search_aspx).txtid.Text), c))} ,
쿼리가 어디에 생성 :
var result = collection.AsQueryable<USER>()
.Where(where_clause)
.Select(c => new { c.ID, c.COMPANYNAME, c.EMAIL
}).Take(100).ToList();
컬렉션은 인스턴스입니다 MongoCollection
코드 WHERE_CLAUSE
VAR를 만들기위한 WHERE_CLAUSE = PredicateBuilder.True(); (ASP.search_aspx).txtid.Text
참조 오히려 현재 값을 평가하기보다는 폐쇄에 캡처 된 것처럼 때문에 Invoke
의
//object result=0;
if ((txtGlid.Text).Trim() != "")
{
where_clause = where_clause.And(c => c.GLUSR_USR_ID == txtGlid.Text);
}
if ((txtEmailid.Text).Trim() != "")
{
where_clause = where_clause.And(c => c.GLUSR_USR_EMAIL == txtEmailid.Text);
}
if ((txtPhone.Text).Trim() != "")
{
where_clause = where_clause.And(c => c.GLUSR_USR_PH_NUMBER == txtPhone.Text);
}
if ((txtMobile.Text).Trim() != "")
{
where_clause = where_clause.And(c => c.GLUSR_USR_PH_MOBILE == txtMobile.Text);
}
'where_clause'를 작성한 코드를 게시 할 수 있습니까? – StuartLC