コード例 #1
0
ファイル: ItemsController.cs プロジェクト: ormaroms/WebStore
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
コード例 #2
0
        public void EntityLinqQuery()
        {
            var context = new WebStoreContext();

            DateTime newDateTime = new DateTime(1900, 1, 1);

            var t = context.Customers.Where(cust=> cust.Id == 1).FirstOrDefault();

            context.Dispose();

            context = new WebStoreContext();

            var watch = Stopwatch.StartNew();

            newDateTime = new DateTime(2000, 1, 1);

            var custList = context.Customers.Where(cust => cust.Entered > newDateTime).ToList();

            watch.Stop();

            Assert.IsNotNull(custList);
            Console.WriteLine(custList.Count);
            Console.WriteLine(watch.ElapsedMilliseconds);
        }
コード例 #3
0
        public void EntityLinqQuery()
        {
            var context = new WebStoreContext();

            DateTime newDateTime = new DateTime(1900, 1, 1);

            var t = context.Customers.Where(cust => cust.Id == 1).FirstOrDefault();

            context.Dispose();

            context = new WebStoreContext();

            var watch = Stopwatch.StartNew();

            newDateTime = new DateTime(2000, 1, 1);

            var custList = context.Customers.Where(cust => cust.Entered > newDateTime).ToList();

            watch.Stop();

            Assert.IsNotNull(custList);
            Console.WriteLine(custList.Count);
            Console.WriteLine(watch.ElapsedMilliseconds);
        }