public void Setup() { EntityMapping.TryRegisterType(typeof(TestModel), out _); Connection = BenchmarkDb.GetConnection(); //Pre-JIT the benchmarks to avoid issues with benchmark FirstOrDefault(); ToArray(); Count(); Any(); }
public void Init() { Task.Run(async() => { while (true) { BenchmarkDb db = _serviceProvider.CreateScope().ServiceProvider.GetService <BenchmarkDb>(); Console.WriteLine("Removing entry"); db.Entries.RemoveRange(db.Entries); db.SaveChanges(); Console.WriteLine("Creating entry"); db.Entries.Add(new BenchmarkEntry()); db.SaveChanges(); await Task.Delay(2000); } }); }