I'm new to EF4, and I'm trying to figure out the best way to create my DbContext class(es).
Is there any problem (specially performance) in putting all my tables / entities into one and only one DbContext class, like the code below?
public class AllInOneDb : DbContext { public DbSet<Customer> Customers{ get; set; } public DbSet<Address> Addresses{ get; set; } public DbSet<Order> Order{ get; set; } public DbSet<Product> Products{ get; set; } public DbSet<Category> Categories{ get; set; } // and more and more entities... } Or should I model my classes based on the subsets of functionalities?
public class CustomerDb : DbContext { public DbSet<Customer> Customers{ get; set; } public DbSet<Address> Addresses{ get; set; } public DbSet<Order> Order{ get; set; } } public class ProductDb : DbContext { public DbSet<Product> Products{ get; set; } public DbSet<Category> Categories{ get; set; } public DbSet<Order> Order{ get; set; } // look Order entity again! } Thanks