毎月の期限切れの製品をすべて取得したいのですが、そのクエリは次のとおりです。
_customerProductsRepository
.Where(
d =>
!d.ReleaseDate.HasValue &&
EntityFunctions.AddMonths(d.RenewalDate ?? d.AcquireDate, 1) < now)
.ToArray();
AcquireDateは製品の最初の購入であり、RenewalDateは製品の最後の更新です。
何らかの理由で、次の SQL に変換されます。
SELECT
[Extent1].[CustomerDidId] AS [CustomerDidId],
[Extent1].[DidNumber] AS [DidNumber],
[Extent1].[CountryId] AS [CountryId],
[Extent1].[CustomerId] AS [CustomerId],
[Extent1].[AcquireDate] AS [AcquireDate],
[Extent1].[ReleaseDate] AS [ReleaseDate],
[Extent1].[RenewalDate] AS [RenewalDate],
[Extent1].[RenewalNotificationDate] AS [RenewalNotificationDate]
FROM [dbo].[CustomerDids] AS [Extent1]
WHERE ([Extent1].[ReleaseDate] IS NULL) AND ((DATEADD (month, 1, [Extent1].[Rene
walDate])) < @p__linq__0)
「??」を参照するケースステートメントが必要です。代わりに、AcquireDate 列を完全に削除しました。
どうすれば歩き回ることができますか?