Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #33678 - TimeOnly.FromDateTime() could not be translated in EF Core 8 #33689

Merged
merged 1 commit into from
May 8, 2024

Conversation

maumar
Copy link
Contributor

@maumar maumar commented May 8, 2024

Adding translation for TimeOnly.FromDateTime and TimeOnly.FromTimeSpan. We already had support for DateOnly.FromDateTime.

Fixes #33678

Copy link
Contributor

@ErikEJ ErikEJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"using ExpressionExtensions = Microsoft.EntityFrameworkCore.Query.ExpressionExtensions;"

  • is that needed?

@maumar
Copy link
Contributor Author

maumar commented May 8, 2024

@ErikEJ ExpressionExtensions that's used to access InferTypeMapping call is ambiguous otherwise

… Core 8

Adding translation for TimeOnly.FromDateTime and TimeOnly.FromTimeSpan. We already had support for DateOnly.FromDateTime.

Fixes #33678

if ((method == FromDateTime || method == FromTimeSpan)
&& instance is null
&& arguments.Count == 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficiently resilient? What if another overload is added with one parameter? Check for the parameter type as well to be sure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetRuntimeMethod already checks parameter type

@maumar maumar merged commit f0eaa02 into main May 8, 2024
7 checks passed
@maumar maumar deleted the fix33678 branch May 8, 2024 19:03
@DmitryGaravsky
Copy link

Hi Team,
First, thank you for addressing the issue. I appreciate your hard work on this fix.

I encountered a problem using the FromDateTime method with EFCore 8 (version 8.0.6). Could you please let me know if this fix will be ported to EFCore 8?

Thank you for your assistance.

@ajcvickers
Copy link
Contributor

@DmitryGaravsky This issue doesn't meet the bar for patching. See the planning process for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TimeOnly.FromDateTime() could not be translated in EF Core 8
4 participants