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

Cleanup in EF.Property #29154

Merged
merged 2 commits into from
Sep 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/EFCore/Infrastructure/MethodInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure;
/// </remarks>
public static class MethodInfoExtensions
{
private static readonly string EFTypeName = typeof(EF).FullName!;

/// <summary>
/// Returns <see langword="true" /> if the given method is <see cref="EF.Property{TProperty}" />.
/// </summary>
/// <param name="methodInfo">The method.</param>
/// <returns><see langword="true" /> if the method is <see cref="EF.Property{TProperty}" />; <see langword="false" /> otherwise.</returns>
public static bool IsEFPropertyMethod(this MethodInfo methodInfo)
=> methodInfo.IsGenericMethod
&& (Equals(methodInfo.GetGenericMethodDefinition(), EF.PropertyMethod)
// fallback to string comparison because MethodInfo.Equals is not
// always true in .NET Native even if methods are the same
|| (methodInfo.Name == nameof(EF.Property)
&& methodInfo.DeclaringType?.FullName == EFTypeName));
&& Equals(methodInfo.GetGenericMethodDefinition(), EF.PropertyMethod);
smitpatel marked this conversation as resolved.
Show resolved Hide resolved
}