This question is locked. New answers and comments are not allowed.
Hi,
Please guide the recommended way to join Dynamic expressions. Basically we have different selection criterias
Like
[ ] By Transaction ID: ________ (.) And ( ) Or
[ ] By Customer ID : __________ (.) And ( ) Or
[ ] By Date : _________ (.) And ( ) Or
.
.
for this we prepare different Dynamic expressions based on user selection like following.
But this approach does allow us to use OR all these clauses generate AND
I tried to join predicates using Expression.And and Expression.Or but resultant predicate is compile and throwing exception as posted previously.
Please Help...
Thanks,
devoas,
Please guide the recommended way to join Dynamic expressions. Basically we have different selection criterias
Like
[ ] By Transaction ID: ________ (.) And ( ) Or
[ ] By Customer ID : __________ (.) And ( ) Or
[ ] By Date : _________ (.) And ( ) Or
.
.
for this we prepare different Dynamic expressions based on user selection like following.
Expression <Func<SalesMaster, bool>> predicatex = c=>c.TranNumb ==2; |
Expression<Func<SalesMaster, bool>> predicatey = c=>c.CustomerId ==2; |
Now Please recommend how can I Join multiple predicates based on AND/OR operation and apply in single Where Cluase.
currently we are using following approach...
var query = from p in scope.Extent<SalesMaster>().Where(predicatex) |
select p; |
query = query.Where(predicatex); |
query = query.Where(predicatey); |
var result = query.ToList(); |
But this approach does allow us to use OR all these clauses generate AND
I tried to join predicates using Expression.And and Expression.Or but resultant predicate is compile and throwing exception as posted previously.
Please Help...
Thanks,
devoas,