.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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -