Complex Expressions
Table Of Contents
What Are Complex Expressions?
Complex Expressions are two or more Conditions grouped together to produce a single boolean result.
When you are crafting your Query instance you chain together one or more conditions.
But you might want to group some of those conditions to be evaluated together. For example the following seudo-code "select all Customers where Balance > 0 or (CreatedDate = today and (status = "new" or status = "inactive"))"
With a simple chain of And, Or we cannot achieve this meaning; this expression.
That is where Complex Expressions come into play in The Sharp Factory Framework.
Complex Expressions And Query
To start an expression add .Where() or Or() to a Query instance using the overload that takes a delegate.
The following C# code sample shows how to achieve the expression "select all Customers where Balance > 0 or (CreatedDate = today and (status = "new" or status = "inactive"))"
Fluent Syntax
Builder Syntax
The examples above are equivalent. The only difference is the syntax.