コード例 #1
0
        public void Setup()
        {
            EntityMapping.TryRegisterType(typeof(TestModel), out _);
            Connection = BenchmarkDb.GetConnection();

            //Pre-JIT the benchmarks to avoid issues with benchmark
            FirstOrDefault();
            ToArray();
            Count();
            Any();
        }
コード例 #2
0
        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);
                }
            });
        }