Ok. Here is my error and I just found what the problem is.
The property 'LogEntry.Timestamp' could not be mapped because it is of type 'Instant', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
Actually its fairly clear what it is trying to say.
I have overridden OnModelCreating but I missed a trivial thing.
Here is my dbcontext class.
public class ExtendedElsaMigrationsDbContext : SqlServerContext
{
public ExtendedElsaMigrationsDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// I should not comment out this base method call.
// base.OnModelCreating(modelBuilder);
// modelBuilder.Entity<User>();
modelBuilder.ConfigureExtendedElsaDbContext();
}
}
Note that I had commented out the base method call. And that is what is causing the problem.
The overridden method should be as follows.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// //modelBuilder.Entity<User>();
modelBuilder.ConfigureExtendedElsaDbContext();
}
Summary: Don't forget to call the base method when you are overriding a method. Many times base method don't do much, so we ignore them. But some times they do. So always call the base methods.
[NotMapped]
as this doesn't look like something you are storing in the database. If you want to store the values in the database, create a new class for the new table, and then map it accordingly (stackoverflow.com/a/30202171/1073631).