Problems Background (you can skip to the question)
I have many ASP.Net websites which are same application. different database but same schema, in the same SQL Server.
The administration site is already implemented in each virtual directory, and I use subsonic
for DAL.
Now instead of creating an administration page for each website, I'm thinking about integrating/creating one site for administrate all these websites.
- http://websiteadmin.com/?website=1
- http://websiteadmin.com/?website=2
- http://websiteadmin.com/?website=3
Since I host the database in the same server and with same database schema, I think I only need to update connection string.
So The Question Is..
how can I switch the subsonic database connection on runtime?
// WebsiteDAL is the subsonic generated namespace
// I've tried to change database causing null error
WebsiteDAL.DB.Repository.Provider.CurrentSharedConnection.ChangeDatabase(db);
// also tried to add connection string and update on runtime,
// but still no effect
WebsiteDAL.DB._provider.ConnectionStringName = "website1connectionstring";
// Records are still loaded from default connection
WebsiteDAL.SomeTables st = WebsiteDAL.SomeTables.FetchByID(1);