Skip to content

Instantly share code, notes, and snippets.

@PhonicUK
Created January 30, 2022 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhonicUK/c17f7217649ab5222bb468f1f1edbe17 to your computer and use it in GitHub Desktop.
Save PhonicUK/c17f7217649ab5222bb468f1f1edbe17 to your computer and use it in GitHub Desktop.
DbContext
protected override void ConfigureConventions(ModelConfigurationBuilder builder)
{
builder.Properties<DateOnly>()
.HaveConversion<DateOnlyConverter>()
.HaveColumnType("date");
builder.Properties<DateOnly?>()
.HaveConversion<NullableDateOnlyConverter>()
.HaveColumnType("date");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment