Bonus Section: Extending C# to Support SQL Syntax at Compile Time
Ever wished you could truly embed SQL functionality in your C# code without
using strings or late binding? Imagine being able to write complex where clauses
purely in C#:
xQuery.Where = (CustomerTbl.Col.NameFirst == "Chad" |
CustomerTbl.Col.NameFirst == "Hadi") &
CustomerTbl.Col.CustomerID > 100 & CustomerTbl.Col.Tag !=
View.Null;
Look closely. This is C# code, not SQL. Its resolved and bound at compile
time, but evaluated at run time. In this article I shall provide an introduction
to this method and full source code for your use.
|