How does one programmaticaly specify the name of the connection for SubSonic 3
Here is the situation.
I am using SubSonic 3 and w开发者_如何学Could like to specify at run time which connection string to use. This a command line application and the connection string name will be specified by the user as a command line argument.
What is the best way to accomplish this?
Our providers are simply wrappers for connection strings - so anywhere you see "IDataProvider" you can create one using ProviderFactory.GetProvider("CONNECTIONSTRING","DataProvider"). I know that looks like a lot of providers :) but the latter is for the connection string to work - in this case it's a string value and should be "System.Data.SqlClient" or whatever you're using.
This will work with ActiveRecord too - Post.SingleOrDefault(MyProvider, x=>x.ID=id);
精彩评论