.net - How to add entity data model programmatically in runtime to Web Api project? -


is possible add entity framework in runtime web api project?

for example/scenario;

the company add 1 branch in runtime. branch's database informations such -connection string -database name stored in table of company's database.

how can add branch's database connectionstring in web.config fie? , how connect database?

you can initialize dbcontext connection string

public mycontext(): dbcontext {     public mycontext(){};     public mycontext(string connectionstring):base(connection){}; } 

and initilize below :

var firstbranch = new mycontext("firstbranchconnection"); var secondbranch = new mycontext("secondbranchconnection"); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -