Castle.ActiveRecord.Framework.Config.InPlaceConfigurationSource.GetConfiguration C# (CSharp) Method

GetConfiguration() public method

Return an IConfiguration for the specified type.
public GetConfiguration ( Type type ) : IConfiguration
type Type
return IConfiguration
		public IConfiguration GetConfiguration(Type type)
		{
			IConfiguration configuration;
			_type2Config.TryGetValue(type, out configuration);
			return configuration;
		}

Usage Example

コード例 #1
0
ファイル: Global.asax.cs プロジェクト: aarjmand/MvcTodo
        public static InPlaceConfigurationSource GetConfigurationSource(bool isWeb)
        {
            // Load the Connection String
            var currentConnectionString = ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString;

            // Create a new set of Configuration, and add the connection string
            var properties = new Dictionary<string, string> { { "connection.connection_string", currentConnectionString } };
            var source = new InPlaceConfigurationSource();
            source.Add(typeof(ActiveRecordBase), properties);

            // Get the configuration from the ActiveRecord section
            var activeRecordSectionSource = ActiveRecordSectionHandler.Instance;
            var activeRecordConfiguration = activeRecordSectionSource.GetConfiguration(typeof(ActiveRecordBase)).Children;
            var connectionStringConfiguration = source.GetConfiguration(typeof(ActiveRecordBase)).Children;

            // Add configuration from the ActiveRecord section
            connectionStringConfiguration.AddRange(activeRecordConfiguration);

            source.IsRunningInWebApp = isWeb;
            return source;
        }