如何在配置中获取对当前 SqlConnection 或 Sqlconnection 的引用?
和代码
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;
}
但我不明白在哪里可以找到“GetConfigSource”实现?这个标准的城堡助手功能与否?
我使用这些命名空间
using Castle.ActiveRecord;
using NHibernate.Criterion;
using NHibernate;
using Castle.Core.Configuration;
using Castle.ActiveRecord.Framework;