How to make LinqPad SQL Window return constants?
I have this LinQ query:
Customers.Select (c => new {
Customer_id = c.Customer_id,
Customer_name = c.Customer_name,
Customer_Campaign = 5,
Customer_Type = "Good!",
})
Why is it that the SQL Translation showed in the SQL Window is:
SELECT [t0].[Customer_id] AS [Customer_id], [t0].[Customer_name] AS [Customer_name]
FROM [Customers] AS [t0]
...Totally ignoring my constants!
I think LinqPad is the best tool ever, and i use it everyday but i also need to do some SQL translations and this is blowing my mind!
Customers.Select (c => new {
Customer_id = c.Customer_id,
Customer_name = c.Customer_name,
Customer_Campaign = 5,
Customer_Type = "Good!",
})
Why is it that the SQL Translation showed in the SQL Window is:
SELECT [t0].[Customer_id] AS [Customer_id], [t0].[Customer_name] AS [Customer_name]
FROM [Customers] AS [t0]
...Totally ignoring my constants!
I think LinqPad is the best tool ever, and i use it everyday but i also need to do some SQL translations and this is blowing my mind!
Comments
LINQ to SQL tries to satisfy your query in the most efficient way possible. So if you ask for a constant, it figures it can supply that constant without round-tripping to a server and back. Unless there's a reason why it needs to include that constant in the query to make it valid, it will leave it out.