Is it possible to make a table/entity in EF Core 3.0? Basically i have history tables on which i want to ristrict insert/update/delete commands.
I already tried AsNoTracking by changing:
public DbSet<SampleHistory> SampleHistories { get; set; }
to:
public IQueryable<SampleHistory> SampleHistories { get {return Set<SampleHistory>).AsNoTracking<SampleHistory>(); } }
It works fine if i do something like this (nothing gets saved in DB):
var v = DbContext.SampleHistories.FirstOrDefault(e => e.HistoryId == 1);
v.Field1 = $"Test{DateTime.Now.ToLongTimeString()}";
DbContext.SaveChanges();
but if i add Update statment before save, i see record getting updated in DB:
var v = DbContext.SampleHistories.FirstOrDefault(e => e.HistoryId == 1);
v.Field1 = $"Test{DateTime.Now.ToLongTimeString()}";
DbContext.Update(v);
DbContext.SaveChanges();
I want to avoid that too.