예제 #1
0
        public void EntitySelectTest(int rows)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            int       effected  = 0;

            using (var db = new netflix())
            {
                var query = from b in db.acounts
                            select b;
                query.Take(rows);
                query.ToList();
                effected = query.Count();
            }
            stopwatch.Stop();
            if (effected < rows)
            {
                Console.WriteLine("Not enough rows. Only " + effected + " rows selected.");
            }
            Console.WriteLine("Entity select " + rows + " Time Elapsed={0}", stopwatch.Elapsed);
        }
예제 #2
0
        public void EntityDeleteTest(int rows)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();
            int       effected  = 0;

            using (var db = new netflix())
            {
                var query = from b in db.acounts
                            select b;
                query.Take(rows);
                foreach (var item in query)
                {
                    db.acounts.Remove(item);
                    effected += 1;
                }
                db.SaveChanges();
            }
            stopwatch.Stop();
            if (effected < rows)
            {
                Console.WriteLine("Not enough rows. Only " + effected + " rows selected.");
            }
            Console.WriteLine("Entity delete " + rows + " Time Elapsed={0}", stopwatch.Elapsed);
        }
예제 #3
0
        public void EntityInsertTest(int rows)
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            using (var db = new netflix())
            {
                for (int i = 0; i < rows; i++)
                {
                    string email  = "email" + i + "@test.nl";
                    var    acount = new acount();
                    acount.email         = email;
                    acount.password      = "******";
                    acount.tries         = 1;
                    acount.isVerified    = 1;
                    acount.membership_id = 1;
                    acount.joinDate      = DateTime.Now;

                    db.acounts.Add(acount);
                }
                db.SaveChanges();
            }
            stopwatch.Stop();
            Console.WriteLine("Entity insert " + rows + " Time Elapsed={0}", stopwatch.Elapsed);
        }