开发者

How does one programmaticaly specify the name of the connection for SubSonic 3

开发者 https://www.devze.com 2022-12-12 02:28 出处:网络
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

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);

0

精彩评论

暂无评论...
验证码 换一张
取 消