Reputation: 21
I have a complex database and would like to know if creating a separate edmx for stored procedures is a good route to take? My idea is to have multiple edmx files, based on the applications using the database. That way each application would have access only to the stored procedures it needed.
Upvotes: 2
Views: 80
Reputation: 45500
I don't see why this would be a problem.
While @Khan might be right on some scenario, I believe if you project is large enough then you can, seperate them if it helps you stay organized.
I have done this in some of my application where I wanted to separate the concerns.
My solution had a admin project and a user project, I added a third one as a DLL which contained two EDMX. Then I added a reference to the same dll on both project.
It just did not seem right for me to mix both Data Access Layer.
Something like this for admin:
private void SomeAdminFunction()
{
using (var db = new AdminEntities())
{
//Access all Admin Stored Procedures
}
}
for users:
private void SomeUserFunction()
{
using (var db = new UserEntities())
{
//Access all User Stored Procedures
}
}
Upvotes: 1
Reputation: 18172
The following reasons NOT to separate EMD
s come to mind
EDM
s means having 2 choices of Context
for what may not have a logical separation.EDM
s does not seem to appear cleaner in any way that I can think of. Upvotes: 1