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

Using default values does not work as expected on non-nullable types #4077

Closed
antonthomas opened this issue Oct 11, 2022 · 1 comment
Closed

Comments

@antonthomas
Copy link

When using the HasDefaultValue() method on fields that are non-nullable, EF does not behave as expected. When explicitly providing a different value for a non-nullable field, the provided value is overridden by the default value. Changing the field to be nullable does however work as expected.

Please make sure to include this in the documentation or possibly file a bug report.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@ajcvickers
Copy link
Contributor

@antonthomas Currently the default value is used whenever the property is set to the CLR default. Configuration of this is tracked by dotnet/efcore#701. Please vote for that issue if this is something you need.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2022
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

No branches or pull requests

2 participants