Bhanu Pratap Singh

Bhanu Pratap Singh

  • NA
  • 94
  • 50.9k

how to make my database layer connect to multiple SQL db

Jul 9 2018 3:28 AM
I am using ADO.Net to connect with SQL server, i use my DBLayer to get data from Database and which returns DataTable and Dataset.
 
In Web API i desealize Datatable to JSOn which i got by calling BAL, and bal calls DAL.
 
Now the requirement is my WEb Api request will contain a Code in header, this header value will decide which database connect to.
 
I have a xml file which contains connectionstrings in format 
</dbs> 
   <db code='xyz' value='full connection string'>
   <db code='pqr' value='full connection string'> 
<dbs>
 
this is the code which lives in HTTPREquest header.
 
 
SO the question is am i doing it in right way. or what is the best way to accomplish this task and optimize my code.
 
 
 
 

Answers (2)