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);
                                }
                            }
                        }
 private AggregatedUserConfiguration.PendingUpdate PrepareUpdate(UserConfigurationDescriptor descriptor, ICoreObject item)
 {
     UserConfigurationDescriptor.MementoClass descriptorMemento = descriptor.ToMemento(this.manager.MailboxSession);
     if (this.memento.Pending.Exists((AggregatedUserConfiguration.PendingUpdate p) => descriptorMemento.Equals(p.DescriptorMemento)))
     {
         ExTraceGlobals.StorageTracer.TraceWarning <StoreObjectId, string>((long)this.GetHashCode(), "The core item with id=[{0}] and name=[{1}] already has a pending update.  It will be marked for rebuild.", item.StoreObjectId, descriptor.ConfigurationName);
         this.memento.ConcurrentUpdates.Add(descriptorMemento);
     }
     AggregatedUserConfiguration.PendingUpdate pendingUpdate = new AggregatedUserConfiguration.PendingUpdate
     {
         Guid              = Guid.NewGuid().ToString(),
         PreparedUtc       = ExDateTime.UtcNow.ToBinary(),
         Descriptor        = descriptor,
         DescriptorMemento = descriptorMemento
     };
     this.memento.Pending.Add(pendingUpdate);
     this.Parts.Remove(descriptorMemento);
     this.memento.Parts.Remove(descriptorMemento);
     this.SaveMemento(AggregatedUserConfiguration.SaveFailureMode.Fail);
     return(pendingUpdate);
 }
 private void RemovePart(UserConfigurationDescriptor.MementoClass descriptor)
 {
     this.parts.Remove(descriptor);
     this.memento.Parts.Remove(descriptor);
 }
 private void RemoveFromFailedToLoad(UserConfigurationDescriptor.MementoClass descriptor)
 {
     this.memento.FailedToLoad.Remove(descriptor);
 }
Beispiel #5
0
 public static UserConfigurationDescriptor FromMemento(UserConfigurationDescriptor.MementoClass memento)
 {
     return(new UserConfigurationDescriptor.FolderIdDescriptor(memento.ConfigurationName, memento.Types, memento.FolderId));
 }