DI for repository while using multiple databases
In an application which uses multiple databases, should I create DBContext object for each database and inject all of them to the repository or should I create a generic DB Context and create repository object based on the database I want to use in different functions?
jaiganesh paramananthamPosted Jan 27, 2015, 6:04 AM
string GetConnection()
}
Class OracleConnection : IDBcontext {
public string GetConnection(){
return "Oracle Connection":
}
}
Class SQLConnection : IDBcontext {
public string GetConnection(){
return " SQL Connection":
}
}
class main(){
IDBcontext _DBcontext;
_DBcontext = new SQLConnection();
_DBcontext = new OracleConnection ();
}