开发者

Passing my own ConnectionString in Castle Active Record

开发者 https://www.devze.com 2022-12-20 04:31 出处:网络
How can I inject my own ConnectionString if using Castle Active开发者_Go百科 Record?I have got the answer for this from http://www.darkside.co.za/archive/2008/01/21/castle-activerecord-connecting-to-m

How can I inject my own ConnectionString if using Castle Active开发者_Go百科 Record?


I have got the answer for this from http://www.darkside.co.za/archive/2008/01/21/castle-activerecord-connecting-to-multiple-databases.aspx

IDbConnection connection = new SqlConnection("Data Source=.;Initial Catalog=TestB;Integrated Security=SSPI");
connection.Open();
using (new DifferentDatabaseScope(connection))
{
    TestTableDatabaseA test3 = TestTableDatabaseA.Find(1);
    Console.WriteLine(test3.Title);
}
0

精彩评论

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

关注公众号