Exemplo n.º 1
0
        internal static void SetProcessTopologyMode(TopologyMode mode)
        {
            if (TopologyMode.Adam == mode)
            {
                throw new ArgumentException("mode. Adam topology mode can't be specified");
            }
            if (TopologyMode.Ldap == mode && TopologyProvider.IsTopologyServiceProcess())
            {
                TopologyProvider.isRunningOnTopologyService = true;
            }
            ExTraceGlobals.TopologyProviderTracer.TraceDebug <TopologyMode, TopologyMode>(0L, "User set topology mode from {0} to {1}", (TopologyProvider.userSetTopologyMode != null) ? TopologyProvider.userSetTopologyMode.Value : TopologyProvider.CurrentTopologyMode, mode);
            TopologyProvider.userSetTopologyMode = new TopologyMode?(mode);
            int          num;
            TopologyMode topologyMode = TopologyProvider.SelectTopologyMode(out num);

            if (TopologyProvider.staticInstance != null && (TopologyProvider.userSetTopologyMode.Value != TopologyProvider.staticInstance.TopologyMode || TopologyProvider.userSetTopologyMode.Value != topologyMode))
            {
                IDisposable      disposable       = TopologyProvider.staticInstance as IDisposable;
                TopologyProvider topologyProvider = TopologyProvider.InitializeInstance();
                topologyProvider.PopulateConfigNamingContextsForLocalForest();
                topologyProvider.PopulateDomainNamingContextsForLocalForest();
                ConnectionPoolManager.Reset();
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }