I have a mvc 5 web application which is working fine as of now for a client. I want to expose this web application as a product now so each client should have their own database to seperate out their data privacy. Now question arise if we choose different database then how MVC entity framework will work with different database because each client will be having seperate model which will impact edmx so Do we need to build a seperate code base for each client. Also Do we need to create seperate virtual directory for each client in IIS to seperate out their deployments so that one deployment will not impact other client.And down the line, if we have more than 100 clients what approach should follow and what piece of code need to pull as common. Below are some questions which should be followed as output:
1. Database must be seperate for client data privacy (client also can ask to share their database with them)
2. Each client should have their own virtual directory so that deployment can be managed easily and one deployment should not impact any other client
3. How application will connect with different database
4. Do we need to seperate the code base based on clients with database first approach or we need to modify code base to work with different clients
There could be other aspects as well but I am looking these points as of now. Please suggest me how can we go ahead on this and design application in such a way that maintenace should be easy and can be scale application later.

sumit kumarPosted Nov 17, 2021, 5:29 AM
Srinivasan RamamoorthiPosted Nov 17, 2021, 4:23 AM
The application should be setup in such a way that each client will have separate instance and can be plugged to back end with different data model. Your base product will have generic data model, on top of it if the user needs customization then the product has to have those in data model and EF has to be updated as per that and hosted into dedicated client instance. If you go for a SaaS product they manage the database for each client in a separate instance not in directories.
try to avoid customization specific to clients, then you have to manage multiple data models and instances. Based on your product domain there should be data model standards, apply those and make the data model flexible to handle multiple clients. With limited configuration of models it has to handle multiple client needs.
Below would be your execution plan
Have a base version of your application code without EF
identify client requirements and create database instance
create EF based on the database
deloy the app to dedicated client instance