Пример #1
0
 internal static void InitializeConfigurableSettings()
 {
     FullSyncConfiguration.ObjectsPerPageLimit = SyncConfiguration.GetConfigurationValue <int>("ObjectsPerPageLimit", 200);
     ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "FullSyncConfiguration.InitializeConfigurableSettings FullSyncConfiguration.ObjectsPerPageLimit = {0}", FullSyncConfiguration.ObjectsPerPageLimit);
     FullSyncConfiguration.LinksPerPageLimit = SyncConfiguration.GetConfigurationValue <int>("LinksPerPageLimit", 2000);
     ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "FullSyncConfiguration.InitializeConfigurableSettings FullSyncConfiguration.LinksPerPageLimit = {0}", FullSyncConfiguration.LinksPerPageLimit);
     FullSyncConfiguration.InitialLinkReadSize = SyncConfiguration.GetConfigurationValue <int>("InitialLinkReadSize", 100);
     ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "FullSyncConfiguration.InitializeConfigurableSettings FullSyncConfiguration.InitialLinkReadSize = {0}", FullSyncConfiguration.InitialLinkReadSize);
 }
Пример #2
0
        internal static Guid GetPreferredDCWithContainerizedUsnChanged(string serviceInstanceName)
        {
            if (!SyncConfiguration.EnableContainerizedUsnChangedOptimization())
            {
                throw new InvalidOperationException("SyncConfiguration.EnableContainerizedUsnChangedOptimization() == false");
            }
            if (serviceInstanceName == null)
            {
                throw new ArgumentNullException("serviceInstanceName");
            }
            string text = serviceInstanceName.ToLowerInvariant() + "_PreferredContainerizedUsnChangedDC";
            string configurationValue = SyncConfiguration.GetConfigurationValue <string>(text, null);

            if (configurationValue != null)
            {
                List <Guid> list = new List <Guid>();
                foreach (string text2 in configurationValue.Split(new char[]
                {
                    ','
                }))
                {
                    Guid item;
                    if (Guid.TryParse(text2, out item))
                    {
                        list.Add(item);
                        ExTraceGlobals.BackSyncTracer.TraceDebug <string, string>((long)SyncConfiguration.TraceId, "GetPreferredDCWithContainerizedUsnChanged Adding a valid DC invocation id: {0} for service instance {1}.", text2, serviceInstanceName);
                    }
                    else
                    {
                        ExTraceGlobals.BackSyncTracer.TraceDebug <string, string>((long)SyncConfiguration.TraceId, "GetPreferredDCWithContainerizedUsnChanged Invalid DC invocation id: {0} defined for service instance {1}. Skipping it.", text2, serviceInstanceName);
                    }
                }
                if (list.Count > 0)
                {
                    Random random = new Random();
                    return(list.ElementAt(random.Next(list.Count)));
                }
                ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "GetPreferredDCWithContainerizedUsnChanged - Found no valid DC invocation ids for service instance: {0}", serviceInstanceName);
            }
            else
            {
                ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "GetPreferredDCWithContainerizedUsnChanged - RegistryValue: {0} is null", text);
            }
            return(Guid.Empty);
        }