Brandon
Brandon

Reputation: 597

Enterprise N-Tier Setup

I have been tasked with switching frameworks and choosing EF as the ORM, but I have been trying to figure out how to do this. I understand the basics of N-Tier, but with our company, we support 15+ applications, and I am trying to understand if we should have separate .EDMX files for each project.

If so, should those be all the in the same project. Would their be a DAL project and multiple .EDMX files, or would there just be one massive .EDMX file with our 100+ tables?

Upvotes: 2

Views: 77

Answers (1)

Yasir
Yasir

Reputation: 1625

Here is what I would recommend:

  1. Have different solutions for each application. Each solution will have its own EDMX file which would reside in the DAL.
  2. You can create one EDMX for hundreds of tables, but it would be better to create a separate EDMX for each sub functionality, if the application has that many tables. In this case you can have multiple EDMXs in the same DAL project.

There are multiple reasons for splitting the EDMX:

  1. Entity Framework uses the ObjectContext to track the changes. If it's tracking 100s of entities, it has to do more work and performance degrades. Limiting each edmx to a smaller number of tables gives better performance.
  2. It's very likely that people can do conflicting changes to the EDMX. You will have to unnecessarily look into merging the changes even if it's not your portion of the functionality. If each sub team works on it's own EDMX, other sub teams will not have such a big impact.

Hope this helps.

Upvotes: 1

Related Questions