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

Use AssemblyQualifiedName to distinguish db functions. Fix issue #18425 #18612

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

pmiddleton
Copy link
Contributor

Update dbfunctions to use the AssemblyQualifiedName in their annotation name. This will prevent nested, and cross assembly, class functions from having name collisions.

Fixes #18425

@@ -121,7 +121,8 @@ public static IEnumerable<DbFunction> GetDbFunctions([NotNull] Model model)
private static string BuildAnnotationName(MethodBase methodBase)
=>
// ReSharper disable once AssignNullToNotNullAttribute
$"{RelationalAnnotationNames.DbFunction}{methodBase.DeclaringType.ShortDisplayName()}{methodBase.Name}({string.Join(",", methodBase.GetParameters().Select(p => p.ParameterType.Name))})";
// ReSharper disable once PossibleNullReferenceException
$"{RelationalAnnotationNames.DbFunction}{methodBase.DeclaringType.AssemblyQualifiedName}{methodBase.Name}({string.Join(",", methodBase.GetParameters().Select(p => p.ParameterType.Name))})";
Copy link
Contributor

Choose a reason for hiding this comment

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

Use namespace qualified name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ParameterType.Name will only return Nullable`1 without the generic parameter for nullable fields so I switched to Fullname to prevent collisions there as well.

@pmiddleton pmiddleton force-pushed the dbFunctionAssemblyNameFix branch from 6ef7c9d to 82becd4 Compare October 29, 2019 02:18
@pmiddleton pmiddleton force-pushed the dbFunctionAssemblyNameFix branch from 82becd4 to 924c618 Compare October 30, 2019 04:23
@AndriySvyryd AndriySvyryd requested a review from Pilchie October 30, 2019 18:46
@pmiddleton pmiddleton force-pushed the dbFunctionAssemblyNameFix branch from 924c618 to 5347ffe Compare October 31, 2019 01:50
@smitpatel
Copy link
Contributor

Can we also update the commit message.
Windows build timed out on CI. I am looking into it.

@smitpatel
Copy link
Contributor

cc: @Pilchie

@smitpatel smitpatel force-pushed the dbFunctionAssemblyNameFix branch from 5347ffe to fe0d550 Compare October 31, 2019 22:13
@smitpatel smitpatel merged commit fe0d550 into dotnet:release/3.1 Oct 31, 2019
@smitpatel
Copy link
Contributor

@pmiddleton - Thanks 😄

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.

DbFunction translation considers two classes the same if they have the same name
4 participants