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

EF Core 210 not including columns with default values in insert into query #13209

Closed
martin-kelley opened this issue Sep 4, 2018 · 2 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@martin-kelley
Copy link

Yes I know this looks like a duplicate from earlier versions of EF core, but it is clearly (to me at least) a bug.

If you have a SQL column of type bit having a default value of true and you model it in EF as a bool and configure the property in code-first with .HasDefaultValue(true), the when you add a new instance o the entity the generated SQL ignores a vale of false in the class instance supplied. It is incorrectly comparing the value to the CLR default value and deciding there is no need to explicitly set the value to false.

It should be comparing the value to the MODEL DEFAULT not the clr and realising that it does indeed need to include the property in the generated SQL.

@ajcvickers
Copy link
Member

@martin-kelley We're not going to change this for 2.2, but we discussed in triage and I have opened #13224 to look at making this a better experience. Using the model default in some way may be something we could consider.

@ajcvickers ajcvickers added closed-no-further-action The issue is closed and no further action is planned. customer-reported labels Sep 5, 2018
@MaStr11
Copy link

MaStr11 commented Dec 17, 2018

I got bitten by the exact same problem too. This behaviour is really astonishing.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants