-
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
Fix ValueGeneratedOnUpdate in scaffolding #18619
Conversation
1b86c4a
to
4f0f24b
Compare
@@ -703,28 +703,16 @@ private void GenerateProperty(IProperty property, bool useDataAnnotations) | |||
if (((IConventionProperty)property).GetValueGeneratedConfigurationSource().HasValue | |||
&& RelationalValueGenerationConvention.GetValueGenerated(property) != valueGenerated) | |||
{ | |||
string methodName; | |||
switch (valueGenerated) | |||
var methodName = valueGenerated switch |
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.
switch block.
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.
Any reason here? We agreed to use it except for complex situations, and this seems as simple as it gets. If we don't use it here we basically don't use it anywhere, no?
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.
3 line ternary as a return of one of the statement. That is complex enough.
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 not how I understand the decision made by the team, and basically invalidates the use of this construct for the vast majority of cases. This isn't extremely important but maybe another opinion would help clarify.
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.
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.
Seems fine to me. Still readable.
src/EFCore.Design/Scaffolding/Internal/CSharpDbContextGenerator.cs
Outdated
Show resolved
Hide resolved
And add some tests. Fixes #18579
4f0f24b
to
aa39b32
Compare
/cc @Pilchie |
And add some tests.
Fixes #18579