protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
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); }
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); }