How to get reference to SqlConnection (or Connection string) in Castle ActiveRecord?

Posted by VoimiX on Stack Overflow See other posts from Stack Overflow or by VoimiX
Published on 2009-10-01T09:20:41Z Indexed on 2010/04/29 0:47 UTC
Read the original article Hit count: 332

Filed under:
|
|

how can I get reference to current SqlConnection or Sqlconnection in config?

I found http://svn.castleproject.org:8080/svn/castle/trunk/ActiveRecord/Castle.ActiveRecord.Tests/DifferentDatabaseScopeTestCase.cs

and code

 private string GetSqlConnection()
        {
            IConfigurationSource config = GetConfigSource();

            IConfiguration db2 = config.GetConfiguration(typeof(ActiveRecordBase));

            string conn = string.Empty;

            foreach (IConfiguration child in db2.Children)
            {
                if (child.Name == "connection.connection_string")
                {
                    conn = child.Value;
                }
            }

            return conn;
        }

But I cant understand where I can find "GetConfigSource" implementation? Is this standart Castle helper function or not?

I use these namespaces

using Castle.ActiveRecord;
using NHibernate.Criterion;
using NHibernate;
using Castle.Core.Configuration;
using Castle.ActiveRecord.Framework;

© Stack Overflow or respective owner

Related posts about castle-activerecord

Related posts about c#