Results 1 to 3 of 3
Thread: Here's a challenge for you all.
Mar 12, 2011, 13:20 #1
Here's a challenge for you all.
I've been toying with the idea of using the core LinqToSql (System.Data.Linq.SqlClient) system to simply generate an sql statement. Without using a data context, or actually executing the query, it should be able to generate the statement and spit it out. An example might look like this:
var sql = SqlQuery<Customer>().Where(x => x.IsActive == true).ToSQL();
And that's pretty much it. It shouldn't run the query, or rely on an active connection or command, just build the tsql based on the model.
If you need to write your own IQueryProvider implementation, you may change the SqlQuery to accept it, but I think it should be possible without one.
Let's see what you can do.