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
Member

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
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
3 participants