[EF] Зачем сортирует по всем полям?
#38686883
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
Ссылка на профиль пользователя:
|
Участник
Откуда: от верблюда
Сообщения: 139
|
|
Есть такой запрос, который генерит такой sql и у меня такой вопрос зачем делается сортировка по всем полям?:
1. 2. 3. 4. 5. 6. 7. 8. 9.
var q = from item in entities.StatisticsOrderView.Where(x => x.OriginType == 6)
join invoiceRow in entities.CustomerInvoiceRow.Where(x => x.Type == 2 && x.State == 0)
on item.InvoiceId equals invoiceRow.InvoiceId into g
select new StatisticsOrderDTO {
Id = item.OriginId,
Rows = g.Select(x => new StatisticsOrderRowDTO {
Id = x.CustomerInvoiceRowId,
})
};
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75.
SELECT *
FROM (SELECT *,
CASE
WHEN ([Extent2].[CustomerInvoiceRowId] IS NULL) THEN CAST(NULL AS int)
ELSE 1
END AS [C1]
FROM (SELECT *
FROM [dbo].[StatisticsOrderView] AS [StatisticsOrderView]) AS [Extent1]
LEFT OUTER JOIN [dbo].[CustomerInvoiceRow] AS [Extent2]
ON (2 = [Extent2].[Type])
AND (0 = [Extent2].[State])
AND ([Extent1].[InvoiceId] = [Extent2].[InvoiceId])
WHERE [Extent1].[OriginType] = 6 /* @p__linq__0 */) AS [Project1]
ORDER BY [Project1].[OwnerActorId] ASC,
[Project1].[ActorId] ASC,
[Project1].[ActorNr] ASC,
[Project1].[SupplierBlockPayment] ASC,
[Project1].[CustomerGracePeriodDays] ASC,
[Project1].[CustomerPriceListTypeId] ASC,
[Project1].[Status] ASC,
[Project1].[StatusName] ASC,
[Project1].[InvoiceType] ASC,
[Project1].[BillingTypeId] ASC,
[Project1].[ProjectId] ASC,
[Project1].[BillingTypeName] ASC,
[Project1].[RemainingAmount] ASC,
[Project1].[RemainingAmountExVat] ASC,
[Project1].[BlockPayment] ASC,
[Project1].[SupplierInvoicePaymentMethodType] ASC,
[Project1].[RegistrationType] ASC,
[Project1].[DeliveryAddressId] ASC,
[Project1].[BillingAddressId] ASC,
[Project1].[BillingInvoicePrinted] ASC,
[Project1].[HasHouseholdTaxDeduction] ASC,
[Project1].[InsecureDebt] ASC,
[Project1].[MultipleAssetRows] ASC,
[Project1].[NoOfReminders] ASC,
[Project1].[NextContractPeriodYear] ASC,
[Project1].[NextContractPeriodValue] ASC,
[Project1].[SysPaymentMethodId] ASC,
[Project1].[PaymentMethodName] ASC,
[Project1].[PaymentRowId] ASC,
[Project1].[PaymentNr] ASC,
[Project1].[PaymentNrString] ASC,
[Project1].[PaymentSeqNr] ASC,
[Project1].[PaymentAmount] ASC,
[Project1].[PaymentAmountCurrency] ASC,
[Project1].[PaymentAmountDiff] ASC,
[Project1].[BankFee] ASC,
[Project1].[SequenceNumber] ASC,
[Project1].[SequenceNumberRecordId] ASC,
[Project1].[PaymentIsSuggestion] ASC,
[Project1].[CurrencyCode] ASC,
[Project1].[CurrencyRate] ASC,
[Project1].[AccountYearId] ASC,
[Project1].[VoucherSeriesId] ASC,
[Project1].[HasVoucher] ASC,
[Project1].[InvoiceTotalAmountCurrency] ASC,
[Project1].[VATAmount] ASC,
[Project1].[InvoicePaidAmount] ASC,
[Project1].[InvoicePaidAmountCurrency] ASC,
[Project1].[InvoicePayAmount] ASC,
[Project1].[InvoicePayAmountCurrency] ASC,
[Project1].[FullyPayed] ASC,
[Project1].[OrderNumbers] ASC,
[Project1].[VATAmountCurrency] ASC,
[Project1].[SysCurrencyId] ASC,
[Project1].[LangId] ASC,
[Project1].[OriginType] ASC,
[Project1].[OriginId] ASC,
[Project1].[InvoiceNr] ASC,
[Project1].[ActorName] ASC,
[Project1].[InvoiceTotalAmount] ASC,
[Project1].[InvoiceId] ASC,
[Project1].[C1] ASC
|
|