Skip to content

Allow EFCore [Required]-Attribute to be nullable #25935

@angelaki

Description

@angelaki

Since EFCore, the IsOptional-Method was removed from the FluentAPI. I've found this question here Required property but Nullable, Entity Framework through Code First, where using IsOptional was a solution for this issue.

What to do now? I'd like to use my EFCore models for both validation and storage but the rules do differ (e.g. Email is allowed to be null in the Database, but not for the validation).

I guess using <nullable>enable</nullable> should be used for this behavior so there is no need to check the [Required] attribute (or make it opt-out / -in at least).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions