.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
Post a Comment