0

我有这个 LinQ 查询:

Customers.Select (c => new { 
Customer_id = c.Customer_id,
Customer_name = c.Customer_name,
Customer_Campaign = 5,
Customer_Type = "Good!",
})

为什么 SQL 窗口中显示的 SQL Translation 是:

SELECT [t0].[Customer_id] AS [Customer_id], [t0].[Customer_name] AS [Customer_name]
FROM [Customers] AS [t0]

...完全无视我的常数!

我认为 LinqPad 是有史以来最好的工具,我每天都使用它,但我还需要做一些 SQL 翻译,这让我大吃一惊!

4

1 回答 1

0

您的常量并非来自 SQL Server。LinqToSQL 仅转换您需要从 DB 获取的数据。而已。您的常量是本地 C# 字符串。无需从数据库中转移它们。

于 2013-11-04T15:52:15.203 回答