When you have a lot of tables in a database (e.g. eCommerce application) ... what's better: Creating an Entity Model containing
all tables, or creating more than one Entity Model, each of it containing logical subsets of related tables? In my opinion it's a tradeoff between having to instanciate a very big class context (using a lot memory though) when only using one Entity
Modell. On the other hand you have to place some essential tables (e.g. the user table) in all of the Entity Models when using multiple Entity Models; and perhaps you have to instanciate more than one class context in your code...
What do you think is better from a practical point of view and for performance reasons?
steschu
Member
45 Points
61 Posts
Big Entity Model vs. Small Entity Model
Apr 12, 2012 08:27 AM|LINK
Hi,
When you have a lot of tables in a database (e.g. eCommerce application) ... what's better: Creating an Entity Model containing all tables, or creating more than one Entity Model, each of it containing logical subsets of related tables? In my opinion it's a tradeoff between having to instanciate a very big class context (using a lot memory though) when only using one Entity Modell. On the other hand you have to place some essential tables (e.g. the user table) in all of the Entity Models when using multiple Entity Models; and perhaps you have to instanciate more than one class context in your code...
What do you think is better from a practical point of view and for performance reasons?
Thanx, SteSchu
mm10
Contributor
6395 Points
1182 Posts
Re: Big Entity Model vs. Small Entity Model
Apr 12, 2012 10:31 AM|LINK
For performance reasons you should start thinking about breaking up a model when it has reached 50-100 entities. Please refer to this article for more details: http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-1.aspx.
steschu
Member
45 Points
61 Posts
Re: Big Entity Model vs. Small Entity Model
Apr 12, 2012 10:39 AM|LINK
Thanx