We have started creating a Project for splitting our current Database in two parts. Currently all the data are stored under one DB and employs code-first approach for create/update DB.
There are 2 approaches to implement this database change in the visual studio solution.
1.
Using the existing datacontext class and passing the connection string when instantiating a new object for updating the records moved to new table.
Merits : There will be less number of code change and only way of instantiating the (with or without arguments) may get changed.
Demerits : As we follow code first migration we are using the DataContext class for updating the database changes\schema, hence keeping the entity classes of both
the databases in a single datacontext class which may cause issue.
2.
Create new datacontext class and move the entity classes(for the particular list of tables moved to new DB).
Merits : It will help to keep two different object instantiation and straight forward in updating the records.
Demerits : This would need more code change. Need to confirm if a two datacontext classes can be used in a same project. Hence may require overall more effort.
Please suggest which approach should i go with and why
Cheers