views:

70

answers:

2

How can I inject my own ConnectionString if using Castle Active Record?

+1  A: 

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