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

preview7 regression: Nullable`1 types treated as required #16894

Closed
Zenexer opened this issue Aug 1, 2019 · 7 comments
Closed

preview7 regression: Nullable`1 types treated as required #16894

Zenexer opened this issue Aug 1, 2019 · 7 comments

Comments

@Zenexer
Copy link

Zenexer commented Aug 1, 2019

I have a model with a Nullable<DateTime> that looks something like this:

public class Model
{
    public DateTime? DeletedAt { get; set; }
}

DateTime is a value type, so DateTime? is a Nullable<DateTime>, not a NRT. DeletedAt is logically initialized to null and isn't required. However, HasData results in the following exception:

The seed entity for entity type 'Model' cannot be added because there was no value provided for the required property 'DeletedAt'.

@Zenexer
Copy link
Author

Zenexer commented Aug 1, 2019

Temporary workaround:

ModelBuilder.Entity<Model>(e =>
{
    e.Property(m => m.DeletedAt).IsRequired(false);
    // ...
});

@Zenexer
Copy link
Author

Zenexer commented Aug 1, 2019

This may have the same underlying cause as #16760, but it pertains to nullable value types instead of NRTs, so I'm not positive. I haven't tested with nightly yet.

@ajcvickers
Copy link
Member

@Zenexer Please post a small, runnable project/solution or complete code listing that demonstrates the behavior you are seeing.

@Zenexer
Copy link
Author

Zenexer commented Aug 2, 2019

@ajcvickers Before I devote considerable time to making a minimal project, do you happen to know whether this was likely fixed along with #16760?

@ajcvickers
Copy link
Member

@Zenexer From the minimal information above, I would guess yes, but it's a very low confidence guess.

@ajcvickers
Copy link
Member

EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.

BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.

@Zenexer
Copy link
Author

Zenexer commented Aug 23, 2019

Confirmed fixed by #16781 in preview8. This issue was a duplicate of #16760.

@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
Projects
None yet
Development

No branches or pull requests

3 participants