c# - ASP.NET Web Application with multiple database support -


we developing asp.net web based application, example if want deploy same web application ms access end or sql end, data access layer should use should configurable.

if go below architecture

model

employee     id     name 

dal

employeeaccessdb (uses inline queries)     getall     getbyid     insert     update     delete  employeesqldb (uses stored procedures)     getall     getbyid     insert     update     delete 

page (uses employeeaccessdb / employeesqldb)

objectdatasource selectmethod="getall" typename=" < employeeaccessdb / employeesqldb >" insert update delete 

so if use access end page should use access dal , if use sql page should use sql dal.

please let me know how can make configurable.

please web.config configuration , in dal read value form web.config , make nessesary call database

you'll need add reference system.configuration. should using configurationmanager

    string activedatabase = configurationmanager.appsettings["activedatabase"]; 

web.config

    <appsettings>      <add key="activedatabase" value="sqldb"/>     </appsettings> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -