I'm following a database first approach in this example. Because of the manageability issue of a single edmx, I have decided to break down the single edmx to multiple edmxs.
I created a project and added a new ADO.net Entity Data Model called AModel. It gave me the option of Choosing DBNameEntities for Save Entity connection string in the App.config. As a result the context is generated as:
public partial class DBNameEntities : DbContext
Now I added another ADO.net Entity Data Model called BModel. I gave the option of selecting DBNameEntities1 as a connection string for 'Save Entity connection string in the App.config'. Since I have already a connecting string which I created for the AModel, I deselected the option for the connection string. Now the context for BModel is generated as (POCO entities generated from the T4 template):
public partial class Entities : DbContext
In a single project, is it okay to use multiple dbContexts (DBNameEntities, Entities) for multiple models?
Or In a single project, is it advisable to use only single dbContext but break down the models into many with different edmxs?
How can I use the same connection string called DBNameEntities for multiple models but at the same time create meaningful contexts. I wanted the context for BModel is generated as BContext and the context for AModel is generated as AContext. eg. public partial class AContext : DbContext
Is the right approach to solving my problem, to create different projects and each project have a model rather than using a single project to have multiple edmxs.
Share your ideas.