First of all, great job on this, I was actually doing it myself as well, but
ended up getting extremely messy and did not get as far as you did, ended up
scrapping it and using this.
Only issue I am having is the following query:
query.Where(x => (x.IsActive || x.IsLocked) && x.EmailAddress ==
"[email protected]");
Is giving the following error:
System.Collections.Generic.KeyNotFoundException : The given key was not present
in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Resolver.LambdaResolver.BuildSql(MemberNode leftMember, MemberNode rightMember, ExpressionType op) in LambdaResolverTree.cs: line 80
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4<T0,T1,T2,T3>(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at Resolver.LambdaResolver.BuildSql(OperationNode node) in LambdaResolverTree.cs: line 46
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2<T0,T1>(CallSite site, T0 arg0, T1 arg1)
at Resolver.LambdaResolver.BuildSql(Node leftNode, Node rightNode, ExpressionType op) in LambdaResolverTree.cs: line 99
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4<T0,T1,T2,T3>(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at Resolver.LambdaResolver.BuildSql(OperationNode node) in LambdaResolverTree.cs: line 46
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2<T0,T1>(CallSite site, T0 arg0, T1 arg1)
at Resolver.LambdaResolver.ResolveQuery(Expression`1 expression) in LambdaResolverQuery.cs: line 18
at LambdaSqlBuilder.SqlLam`1.And(Expression`1 expression) in SqlLam.cs: line 47
at LambdaSqlBuilder.SqlLam`1.Where(Expression`1 expression) in SqlLam.cs: line 41
at Tests.ExpressionTests.WhereMultipleBoolAndElse_Should_ReturnQuery() in ExpressionTests.cs: line 364
The only workaround I was able to do is add "== true" to both booleans, however
if I only did 1 boolean, it works fine
Example..
query.Where(x => (x.IsActive || x.CreatedOn == date) && x.EmailAddress ==
"[email protected]");
This one works without issue