我不擅长Linq的表达,今天我遇到了一个奇怪的问题,如下面的内连接语句,
var orders = (from q in dao.CurrentDBContext.New_OrderForm join d in dao.CurrentDBContext.New_OrderGoodsDetail on q.billNum equals d.billNum select new { q.billNum, q.orderSource, q.sourceOddNum d.PPT }
当我追踪linq语句时,我很困惑,Entity Framework
将linq语句转换为下面的sql语句
SELECT [Extent1].[billNum] AS [billNum], [Extent1].[orderSource] AS [orderSource], [Extent1].[sourceOddNum] AS [sourceOddNum], [Extent2].[PPT] AS [PPT] FROM [dbo].[New_OrderForm] AS [Extent1] INNER JOIN [dbo].[New_OrderGoodsDetail] AS [Extent2] ON ([Extent1].[billNum] = [Extent2].[billNum]) OR (([Extent1].[billNum] IS NULL) AND ([Extent2].[billNum] IS NULL))
你知道为什么下面的SQL段会自动附加吗?
或(([Extent1].[billNum] IS NULL)AND([Extent2].[billNum] IS NULL) "
我不希望上面的内容自动附加,因为它确实降低了SQL性能.有什么建议?