Celebrating 8 Successful Years
+1 (315)-715-8489

How to Use a EDMX file for multiple DB having same type of table and schema

1.There are 3 database are have same type of table for 3 application.

Tables are
2.Another database to manage the applications  having a table to store the Application ID ,server name, DBname, Password and username  of application database.

3. Create an EDMX file for the Application that will work as a template and another for the DB to manage the Application

4.While creating the EDMX file the class  generate by EDMX file is

5. Create a class of same class name as above with a parameterized constructor to pass the connection string to this for change the Db connection string dynamically.

6. Based on the application id we will get the database detail and pass to the function to change the connection string.

Copy the connection  string for applicationDB from web.config file and put that in a string and change the server name, DBname, Password and username  of application based on Appid.

7.GetuserDBbyAppid() function we will get the entity for the particular DB .then we can use the Entity Framework to curd operation on that DB.

Need not required to create EDMX file for same type of database which are situated in different servers and all server can manage through an application means we can create users in base application so that user can login in assigned application.

Pradeep - Software Developer

Get In Touch


© Copyright 2016 by SKG Infosolution. All rights reserved