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

Don't warn in model validation when bool property with default value has nullable backing field #30395

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

ajcvickers
Copy link
Member

Fixes #28509

@ajcvickers ajcvickers requested a review from a team March 3, 2023 12:19
|| property.GetDefaultValueSql(table) != null))
if (property.ClrType == typeof(bool)
&& property.ValueGenerated != ValueGenerated.Never
&& property.FieldInfo?.FieldType != typeof(bool?)
Copy link
Member

Choose a reason for hiding this comment

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

Do we support backing fields with a totally different type (e.g. bool property backed by a string field)? If so, I'm guessing we don't want to warn for that case either?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that's not supported.

@ajcvickers
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers ajcvickers merged commit 66612ed into main Mar 3, 2023
@ajcvickers ajcvickers deleted the WeGoodThenNoBeef0303 branch March 3, 2023 19:12
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.

ValidateBoolsWithDefaults should take bool? backing fields into account
2 participants