I have a column definition that works ok for persisting and querying typed json data
Entities
public class TimeLineDefinition()
{
public DateTime StartDateUtc { get; init; }
}
public class ProductData()
{
public ProductData(TimeLineDefinition timeLineDefinition)
{
TimeLineDefinition = timeLineDefinition;
}
public int Id {get;set;}
public TimeLineDefinition TimeLineDefinition {get;set;}
}
Mapping
public class ProductDataConfiguration : IEntityTypeConfiguration<ProductData>
{
public void Configure(EntityTypeBuilder<ProductData> builder)
{
builder.HasKey(p => p.Id);
builder.Property(p => p.StartDateTimeUtc)
.HasColumnType("timestamp with time zone");
builder.OwnsOne( t => t.TimeLineDefinition ,navigationBuilder => {
navigationBuilder.ToJson();
});
}
}
This Setup persists the object TimeLineDefinition as json in the column TimeLineDefinition .
I now want to have a type
public class TimeLineDefinitionWithEndDate() :TimeLineDefinition
{
public DateTime EndDateUtc { get; init; }
}
that should persist and read StartDateUtc and EndDateUtc. Is this possible with PostgresProvider in EF?