We are using EF Core and SQL Server 2016 for our .NET Core Web API. I am evaluating use of temporal tables and its impact on EF Core code. When I generate the EF model using cmdline then it generates model with appstart, append and mappings in dbcontext
. When I do insert/update they fail saying these columns cannot be updated. I had to remove appstart, end from model and dbcontext
mapping to make it work. I read there is no interception capability yet in EF Core like EF 6.x.
Please advise about any better solutions for this.
I tried below options and they are working.
option 1: removed appstart, append fields from entities and dbcontext mappings and updates/insert started working properly.
option 2: decorate period columns with attributes as below.
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime StartTime { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime EndTime { get; set; }