Beispiel #1
0
        public void RemoveRange(List <BenchmarkResult> benchmarkResults, List <Customer> customers)
        {
            var clock = new Stopwatch();
            var ids   = customers.Select(x => x.CustomerID);

            using (var db = new DbBestOrm())
            {
                clock.Start();
                db.Customers.Where(c => ids.Contains(c.CustomerID)).Delete();
                clock.Stop();
                var x = (from c in db.Customers
                         select c).ToList();
                benchmarkResults.Add(new BenchmarkResult()
                {
                    Action = "Linq2Db RemoveRange", Entities = customers.Count - x.Count, Performance = clock.ElapsedMilliseconds + " ms"
                });
            }
        }
Beispiel #2
0
        public void Filtering(List <BenchmarkResult> benchmarkResults, List <Customer> customers)
        {
            var clock = new Stopwatch();

            using (var db = new DbBestOrm())
            {
                clock.Start();
                var query = from c in db.Customers
                            where c.IsActive
                            select c;
                var x = query.ToList();
                clock.Stop();
                benchmarkResults.Add(new BenchmarkResult()
                {
                    Action = "Linq2Db Where\t", Entities = x.Count, Performance = clock.ElapsedMilliseconds + " ms"
                });
            }
        }
Beispiel #3
0
        public List <Customer> UpdateRange(List <BenchmarkResult> benchmarkResults, List <Customer> customers)
        {
            var x     = new List <Customer>();
            var clock = new Stopwatch();

            using (var db = new DbBestOrm())
            {
                clock.Start();
                db.Customers.Set(p => p.IsActive, true).Update();
                clock.Stop();
                x = (from c in db.Customers
                     select c).ToList();
                benchmarkResults.Add(new BenchmarkResult()
                {
                    Action = "Linq2Db UpdateRange", Entities = x.Count, Performance = clock.ElapsedMilliseconds + " ms"
                });
            }
            return(x);
        }