コード例 #1
0
        public static ConfigurationContext Establish(Configuration configuration)
        {
            var current = Current;

            if (current != null && !current.AllowOverride)
            {
                throw new InvalidOperationException("ConfigurationContexts cannot be nested.");
            }

            current = new ConfigurationContext(configuration);
            CallContext.LogicalSetData(callContextKey, current.Id);
            contexts.GetOrAdd(current.Id, current);

            return current;
        }