// Token: 0x06000F80 RID: 3968 RVA: 0x0002DF3C File Offset: 0x0002C13C
        protected override void FillProperties(Type type, PSObject psObject, object dummyObject, IList <string> properties)
        {
            ConfigurableObject configurableObject = dummyObject as ConfigurableObject;

            if (configurableObject == null)
            {
                throw new ArgumentException("This method only support ConfigurableObject; please override this method if not this type!");
            }
            if (psObject.Members["ExchangeVersion"] != null)
            {
                PropertyBag           propertyBag           = configurableObject.propertyBag;
                ExchangeObjectVersion exchangeObjectVersion = MockObjectCreator.GetPropertyBasedOnDefinition(propertyBag.ObjectVersionPropertyDefinition, psObject.Members["ExchangeVersion"].Value) as ExchangeObjectVersion;
                if (exchangeObjectVersion != null)
                {
                    configurableObject.SetExchangeVersion(exchangeObjectVersion);
                }
            }
            foreach (PSMemberInfo psmemberInfo in psObject.Members)
            {
                if (properties.Contains(psmemberInfo.Name))
                {
                    this.FillProperty(type, psObject, configurableObject, psmemberInfo.Name);
                }
            }
            configurableObject.ResetChangeTracking();
        }
 public virtual IEnumerable <T> FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) where T : IConfigurable, new()
 {
     base.CheckDisposed();
     if (!typeof(ConfigurableObject).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()))
     {
         throw new NotSupportedException("FindPaged: " + typeof(T).FullName);
     }
     foreach (T item in this.InternalFindPaged <T>(filter, rootId, deepSearch, sortBy, pageSize))
     {
         ConfigurableObject userConfigurationObject = (ConfigurableObject)((object)item);
         foreach (PropertyDefinition propertyDefinition in userConfigurationObject.ObjectSchema.AllProperties)
         {
             ProviderPropertyDefinition providerPropertyDefinition = propertyDefinition as ProviderPropertyDefinition;
             if (providerPropertyDefinition != null && !providerPropertyDefinition.IsCalculated)
             {
                 object obj = null;
                 userConfigurationObject.propertyBag.TryGetField(providerPropertyDefinition, ref obj);
                 userConfigurationObject.InstantiationErrors.AddRange(providerPropertyDefinition.ValidateProperty(obj ?? providerPropertyDefinition.DefaultValue, userConfigurationObject.propertyBag, true));
             }
         }
         userConfigurationObject.ResetChangeTracking(true);
         yield return(item);
     }
     yield break;
 }
        IConfigurable IConfigDataProvider.Read <T>(ObjectId identity)
        {
            IConfigurable      configurable       = this.ReadImpl <T>(identity);
            ConfigurableObject configurableObject = configurable as ConfigurableObject;

            if (configurableObject != null)
            {
                configurableObject.ResetChangeTracking();
            }
            return(configurable);
        }
 IEnumerable <T> IConfigDataProvider.FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize)
 {
     foreach (T t in this.FindImpl <T>(base.AddTenantIdFilter(filter), rootId, deepSearch, sortBy, pageSize))
     {
         ConfigurableObject configurableObject = t as ConfigurableObject;
         if (configurableObject != null)
         {
             configurableObject.ResetChangeTracking();
         }
         yield return(t);
     }
     yield break;
 }
Example #5
0
        protected override void InternalSave(ConfigurableObject instance)
        {
            VersionedXmlConfigurationObject versionedXmlConfigurationObject = (VersionedXmlConfigurationObject)instance;

            using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(base.MailboxSession, versionedXmlConfigurationObject.UserConfigurationName, UserConfigurationTypes.XML, true))
            {
                using (Stream xmlStream = mailboxConfiguration.GetXmlStream())
                {
                    VersionedXmlBase.Serialize(xmlStream, (VersionedXmlBase)versionedXmlConfigurationObject[versionedXmlConfigurationObject.RawVersionedXmlPropertyDefinition]);
                }
                mailboxConfiguration.Save();
            }
            instance.ResetChangeTracking();
        }
Example #6
0
 IEnumerable <T> IConfigDataProvider.FindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize)
 {
     FfoRecipientSession.LogUnsupportedQueryFilter(typeof(T), filter);
     foreach (T t in this.FindImpl <T>(filter, rootId, deepSearch, sortBy, pageSize))
     {
         ConfigurableObject configurableObject = t as ConfigurableObject;
         if (configurableObject != null)
         {
             configurableObject.ResetChangeTracking();
         }
         yield return(t);
     }
     yield break;
 }
        public virtual void Save(IConfigurable instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            ConfigurableObject configurableObject = instance as ConfigurableObject;

            if (configurableObject == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            ValidationError[] array = configurableObject.Validate();
            if (array.Length > 0)
            {
                throw new DataValidationException(array[0]);
            }
            this.InternalSave(configurableObject);
            configurableObject.ResetChangeTracking(true);
        }
        public void Delete(IConfigurable instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            ConfigurableObject configurableObject = instance as ConfigurableObject;

            if (configurableObject == null)
            {
                throw new NotSupportedException("Delete: " + instance.GetType().FullName);
            }
            if (configurableObject.ObjectState == ObjectState.Deleted)
            {
                throw new InvalidOperationException(ServerStrings.ExceptionObjectHasBeenDeleted);
            }
            this.InternalDelete(configurableObject);
            configurableObject.ResetChangeTracking();
            configurableObject.MarkAsDeleted();
        }