-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Annotate the remainder of metadata for nullability #23905
Conversation
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
72263d3
to
5b64e1a
Compare
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Extensions/RelationalEntityTypeBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
@@ -334,7 +336,7 @@ public static class RelationalModelBuilderExtensions | |||
/// <returns> A builder to further configure the function. </returns> | |||
public static IConventionDbFunctionBuilder HasDbFunction( | |||
[NotNull] this IConventionModelBuilder modelBuilder, | |||
[NotNull] string name, | |||
[CanBeNull] string? name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be NotNull
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called from RelationalEntityTypeBuilderExtensions.ToFunction with a null name. Should we add another HasDbFunction on RelationalModelBuilderExtensions which doesn't accept a returnType, and accepts a nullable name? Or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just shouldn't be called if name is null
, it will throw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm misunderstanding, but I don't see where RelationalEntityTypeBuilderExtensions.ToFunction would throw before calling this... Did you want me to add a check and throw somewhere, or just skip the HasDbFunction call (and so just do SetFunctionName(null)
on the entity type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean if HasDbFunction
is called with null
name
then Check.NotEmpty
will throw, so the HasDbFunction
call should be skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, adding a condition in ToFunction around the HasDbFunction call to skip it when name is null (so it only performs SetFunctionName)
src/EFCore.Relational/Metadata/Conventions/EntityTypeHierarchyMappingConvention.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/EFCore/Metadata/Conventions/NotMappedMemberAttributeConvention.cs
Outdated
Show resolved
Hide resolved
…MappingConvention.cs Co-authored-by: Andriy Svyryd <[email protected]>
It merged without waiting for checks to complete 😮 |
Yeah... Just posted on the team channel. I guess we don't have a rule that requires CI checks to be green... |
By design. Hopefully the auto-complete feature is not limited to the same rules for manual merges, otherwise I doubt we can use it. |
😥 welp, at least the build happened to pass, looks like I'm a pretty lucky guy... Yes, AFAIK the feature simply applies the rules that have been defined. If we want to be able to manually merge even though the CI isn't passing, I guess we'll have to disable this. |
Then it doesn't replace the bot, just offers a different way of merging |
If we can't use it before CI is done, I'd personally just use the bot... |
We could require green again, but we know that there are times when C.I. flakiness makes that difficult. It's up to the team. |
Sorry @AndriySvyryd :(
There's a lot of stuff here, I did my best - I know there are some bangs that could be investigated further. I suggest concentrating on the public APIs - anything on private/internal can be easily improved later.
Note that for the various Builders, the vast majority of accesses assume they aren't null (i.e. not removed from the model). So I made them non-nullable, and added a separate IsInModel property for checking that. Did similar with ConventionDispatcher and the recently-introduced IsReadonly.
Part of #19007