internal MsoServerHistoryManager(string serviceInstanceName, int maxServerHistoryEntries, bool createRootContainer)
        {
            this.serverHistorySession             = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 63, ".ctor", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Sync\\MsoServerHistoryManager.cs");
            this.serverHistorySession.UseConfigNC = false;
            this.MaxServerHistoryEntries          = maxServerHistoryEntries;
            this.ServiceInstanceName = serviceInstanceName;
            ADObjectId serviceInstanceObjectId = SyncServiceInstance.GetServiceInstanceObjectId(this.ServiceInstanceName);
            Container  container = this.serverHistorySession.Read <Container>(serviceInstanceObjectId.GetChildId("ServerHistory"));

            if (container == null && createRootContainer)
            {
                container = new Container();
                container.SetId(serviceInstanceObjectId.GetChildId("ServerHistory"));
                try
                {
                    this.serverHistorySession.Save(container);
                }
                catch (ADObjectAlreadyExistsException)
                {
                }
            }
            if (container != null)
            {
                ServerHistoryEntry[] array = this.serverHistorySession.Find <ServerHistoryEntry>(container.Id, QueryScope.OneLevel, null, null, 0);
                Array.Sort <ServerHistoryEntry>(array, (ServerHistoryEntry x, ServerHistoryEntry y) => DateTime.Compare(DateTime.Parse(x.Name.Substring(0, x.Name.IndexOf("-"))), DateTime.Parse(y.Name.Substring(0, y.Name.IndexOf("-")))));
                this.serverHistoryEntriesList     = array.ToList <ServerHistoryEntry>();
                this.serverHistoryRootContainerID = container.Id;
            }
        }
Beispiel #2
0
        internal static SyncServiceInstance GetSyncServiceInstance(string serviceInstanceName)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 160, "GetSyncServiceInstance", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\Sync\\ServiceInstanceId.cs");

            topologyConfigurationSession.UseConfigNC = false;
            ADObjectId serviceInstanceObjectId = SyncServiceInstance.GetServiceInstanceObjectId(serviceInstanceName);

            return(topologyConfigurationSession.Read <SyncServiceInstance>(serviceInstanceObjectId));
        }
Beispiel #3
0
 internal static ADObjectId GetServiceInstanceObjectId(string serviceInstanceName)
 {
     return(SyncServiceInstance.GetMsoSyncRootContainer().GetChildId(serviceInstanceName));
 }