Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

ajcvickers
Copy link
Contributor

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
Contributor 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
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers
Copy link
Contributor 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
# for free to join this conversation on GitHub. Already have an account? # 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