public void TestEnumerableOutsideContext() { IEnumerable<Customer> customers; using (EntityContext context = new EntityContext()) { var repository = new CustomerRepository(context); customers = repository.GetAllEnumerable(); } //note the The operation cannot be completed because the DbContext has been disposed. Debug.WriteLine(string.Format("Customer count:{0}", customers.Count())); }