Type 'Nullable<DateTime>' is not supported by current database provider
See original GitHub issueHi,
I have this model:
public class Advertisement
{
public int AdvertisementId { get; set; }
...
public DateTime? AvailableDate { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
On the ApplicationDbContext
under OnModelCreating
I have the following code:
builder.Property(p => p.AvailableDate).IsRequired(false).HasColumnType("date");
When I try dotnet ef migrations add initial_migration
I get the following error:
The property 'Advertisement.AvailableDate' is of type 'Nullable<DateTime>' which is not supported by current database provider. Either change the property CLR type or ignore the property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
What I am doing wrong here? Thank you for your help…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
The property X is of type Y which is not supported by ...
I get the error: InvalidOperationException: The property 'Branch.Address' is of type 'Address' which is not supported by current database ...
Read more >Entity Framework Core: System.InvalidOperationException ...
InvalidOperationException: The property X is of type Y which is not supported by current database provider. Either change the property CLR ...
Read more >DateOnly and TimeOnly support with Entity Framework Core 6.0
This happens because the underlying provider, Microsoft. Data. SqlClient, does not supported them neither, as described on a GitHub issue.
Read more >Value Conversions - EF Core
The provider type is the .NET type understood by the database provider. ... A null value will never be passed to a value...
Read more >Entity Properties - EF Core
C# 8 introduced a new feature called nullable reference types (NRT), which allows reference types to be annotated, indicating whether it is ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Related npgsql/npgsql#1965. Will fix it in the upcoming weekend.
Closing as no additional info was provided within 7 days. But please feel free to post back here with the relevant information and I’ll reopen if necessary.