private void CommitUpdate(AggregatedUserConfiguration.PendingUpdate pending) { bool flag = true; if (this.memento.ConcurrentUpdates.Contains(pending.DescriptorMemento)) { flag = false; ExTraceGlobals.StorageTracer.TraceWarning <string>((long)this.GetHashCode(), "The configuration object with name[{0}] will not be committed because it is in the concurrent update list.", pending.Descriptor.ConfigurationName); } if (this.RemoveFromPendingAndConcurrent(pending) == 0) { flag = false; ExTraceGlobals.StorageTracer.TraceWarning <string>((long)this.GetHashCode(), "The configuration object with name[{0}] will not be committed because it was not found as a pending update.", pending.Descriptor.ConfigurationName); } if (flag) { IUserConfiguration userConfiguration = null; AggregatedUserConfigurationPart aggregatedUserConfigurationPart = null; try { if (this.TryInternalLoadConfiguration(() => pending.Descriptor.GetConfiguration(this.manager), null, delegate(IUserConfiguration c) { pending.Descriptor.Validate(c); }, out userConfiguration)) { aggregatedUserConfigurationPart = AggregatedUserConfigurationPart.FromConfiguration(userConfiguration); this.memento.Parts.Add(pending.DescriptorMemento, aggregatedUserConfigurationPart.Memento); this.memento.FailedToLoad.Remove(pending.DescriptorMemento); } } finally { DisposeGuard.DisposeIfPresent(userConfiguration); DisposeGuard.DisposeIfPresent(aggregatedUserConfigurationPart); } } this.SaveMemento(AggregatedUserConfiguration.SaveFailureMode.Fail); }
private void InitializeMissingParts() { bool flag = false; IEnumerable <UserConfigurationDescriptor> enumerable = Enumerable.Empty <UserConfigurationDescriptor>(); if (this.aggregatedConfiguration != null) { enumerable = from d in this.descriptor.Sources where !this.parts.ContainsKey(d.ToMemento(this.manager.MailboxSession)) select d; } using (IEnumerator <UserConfigurationDescriptor> enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { AggregatedUserConfiguration.< > c__DisplayClass1c CS$ < > 8__locals1 = new AggregatedUserConfiguration.< > c__DisplayClass1c(); CS$ < > 8__locals1.< > 4__this = this; CS$ < > 8__locals1.missingDescriptor = enumerator.Current; UserConfigurationDescriptor.MementoClass missingDescriptorMemento = CS$ < > 8__locals1.missingDescriptor.ToMemento(this.manager.MailboxSession); if (this.memento.FailedToLoad.Contains(missingDescriptorMemento)) { ExTraceGlobals.StorageTracer.TraceDebug <string>((long)this.GetHashCode(), "the missing configuration part with name=[{0}] failed to load once already and will not be initialized again", CS$ < > 8__locals1.missingDescriptor.ConfigurationName); } else { IUserConfiguration userConfiguration = null; try { if (!this.TryInternalLoadConfiguration(() => CS$ < > 8__locals1.missingDescriptor.GetConfiguration(CS$ < > 8__locals1.< > 4__this.manager), null, delegate(IUserConfiguration c) { CS$ < > 8__locals1.missingDescriptor.Validate(c); }, out userConfiguration)) { ExTraceGlobals.StorageTracer.TraceDebug <string>((long)this.GetHashCode(), "the missing configuration part with name=[{0}] failed to load", CS$ < > 8__locals1.missingDescriptor.ConfigurationName); this.memento.FailedToLoad.Add(missingDescriptorMemento); flag = true; } else { AggregatedUserConfigurationPart aggregatedUserConfigurationPart = AggregatedUserConfigurationPart.FromConfiguration(userConfiguration); this.parts[missingDescriptorMemento] = aggregatedUserConfigurationPart; if (this.memento.Pending.Exists((AggregatedUserConfiguration.PendingUpdate p) => missingDescriptorMemento.Equals(p.DescriptorMemento))) { ExTraceGlobals.StorageTracer.TraceDebug <string>((long)this.GetHashCode(), "the missing configuration part with name=[{0}] will not be persisted because it has a pending update", CS$ < > 8__locals1.missingDescriptor.ConfigurationName); } else { ExTraceGlobals.StorageTracer.TraceDebug <string>((long)this.GetHashCode(), "adding missing part {0} to the persisted aggregated configuration", CS$ < > 8__locals1.missingDescriptor.ConfigurationName); flag = true; this.memento.Parts.Add(missingDescriptorMemento, aggregatedUserConfigurationPart.Memento); } } }