Ejemplo n.º 1
0
        internal static void PublishedUrlSetter(object value, IPropertyBag propertyBag, SimpleProviderPropertyDefinition propertyDefinition)
        {
            string text = (string)value;

            if (string.IsNullOrEmpty(text))
            {
                propertyBag[propertyDefinition] = null;
                return;
            }
            PublishingUrl publishingUrl = PublishingUrl.Create(text);
            ObscureUrl    obscureUrl    = publishingUrl as ObscureUrl;

            if (obscureUrl == null)
            {
                propertyBag[propertyDefinition] = text;
                return;
            }
            propertyBag[propertyDefinition] = obscureUrl.ChangeToKind(ObscureKind.Restricted).ToString();
        }
Ejemplo n.º 2
0
 public ADPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, string ldapDisplayName, ADPropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, SimpleProviderPropertyDefinition mservPropertyDefinition = null, SimpleProviderPropertyDefinition mbxPropertyDefinition = null) : this(name, versionAdded, type, null, ldapDisplayName, null, flags, defaultValue, readConstraints, writeConstraints, SimpleProviderPropertyDefinition.None, null, null, null, mservPropertyDefinition, mbxPropertyDefinition)
 {
 }
        // Token: 0x060004EF RID: 1263 RVA: 0x00019FB8 File Offset: 0x000181B8
        public Dictionary <string, object> ToDictionary()
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (PropertyDefinition propertyDefinition in this.ObjectSchema.AllProperties)
            {
                object obj;
                if (string.Compare(propertyDefinition.Name, "ObjectState", true) != 0 && string.Compare(propertyDefinition.Name, "ExchangeVersion") != 0 && base.TryGetValueWithoutDefault(propertyDefinition, out obj) && obj != null)
                {
                    if (typeof(QueryableObject).IsAssignableFrom(propertyDefinition.Type))
                    {
                        object arg = obj;
                        SimpleProviderPropertyDefinition simpleProviderPropertyDefinition = propertyDefinition as SimpleProviderPropertyDefinition;
                        if (simpleProviderPropertyDefinition != null)
                        {
                            if (simpleProviderPropertyDefinition.IsMultivalued)
                            {
                                List <Dictionary <string, object> > list = new List <Dictionary <string, object> >();
                                if (QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site1 == null)
                                {
                                    QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site1 = CallSite <Func <CallSite, object, IEnumerable> > .Create(Binder.Convert(CSharpBinderFlags.None, typeof(IEnumerable), typeof(QueryableObject)));
                                }
                                using (IEnumerator enumerator2 = QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site1.Target(QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site1, arg).GetEnumerator())
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        if (QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site2 == null)
                                        {
                                            QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site2 = CallSite <Func <CallSite, object, QueryableObject> > .Create(Binder.Convert(CSharpBinderFlags.ConvertExplicit, typeof(QueryableObject), typeof(QueryableObject)));
                                        }
                                        QueryableObject queryableObject = QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site2.Target(QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site2, enumerator2.Current);
                                        list.Add(queryableObject.ToDictionary());
                                    }
                                }
                                dictionary.Add(propertyDefinition.Name, list);
                            }
                            else
                            {
                                if (QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site3 == null)
                                {
                                    QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site3 = CallSite <Action <CallSite, Dictionary <string, object>, string, object> > .Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "Add", null, typeof(QueryableObject), new CSharpArgumentInfo[]
                                    {
                                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
                                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
                                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
                                    }));
                                }
                                Action <CallSite, Dictionary <string, object>, string, object> target = QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site3.Target;
                                CallSite <> p__Site = QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site3;
                                Dictionary <string, object> arg2 = dictionary;
                                string name = propertyDefinition.Name;
                                if (QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site4 == null)
                                {
                                    QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site4 = CallSite <Func <CallSite, object, object> > .Create(Binder.InvokeMember(CSharpBinderFlags.None, "ToDictionary", null, typeof(QueryableObject), new CSharpArgumentInfo[]
                                    {
                                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
                                    }));
                                }
                                target(< > p__Site, arg2, name, QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site4.Target(QueryableObject.< ToDictionary > o__SiteContainer0.< > p__Site4, arg));
                            }
                        }
                    }
                    else
                    {
                        dictionary.Add(propertyDefinition.Name, obj);
                    }
                }
            }
            return(dictionary);
        }
Ejemplo n.º 4
0
 internal ADPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, string ldapDisplayName, ADPropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, CustomFilterBuilderDelegate customFilterBuilderDelegate, GetterDelegate getterDelegate, SetterDelegate setterDelegate, SimpleProviderPropertyDefinition mservPropertyDefinition = null, SimpleProviderPropertyDefinition mbxPropertyDefinition = null) : this(name, versionAdded, type, null, ldapDisplayName, null, flags, defaultValue, readConstraints, writeConstraints, supportingProperties, customFilterBuilderDelegate, getterDelegate, setterDelegate, mservPropertyDefinition, mbxPropertyDefinition)
 {
 }
Ejemplo n.º 5
0
 internal ADPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, IFormatProvider formatProvider, string ldapDisplayName, string shadowLdapDisplayName, string softLinkLdapDisplayName, ADPropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, CustomFilterBuilderDelegate customFilterBuilderDelegate, GetterDelegate getterDelegate, SetterDelegate setterDelegate, SimpleProviderPropertyDefinition mservPropertyDefinition = null, SimpleProviderPropertyDefinition mbxPropertyDefinition = null) : base(name, versionAdded, type, (PropertyDefinitionFlags)flags, defaultValue, readConstraints, writeConstraints, supportingProperties, customFilterBuilderDelegate, getterDelegate, setterDelegate)
 {
     this.formatProvider          = formatProvider;
     this.ldapDisplayName         = ldapDisplayName;
     this.mservPropertyDefinition = mservPropertyDefinition;
     this.mbxPropertyDefinition   = mbxPropertyDefinition;
     if (string.IsNullOrEmpty(this.LdapDisplayName))
     {
         if (!this.IsCalculated && !this.IsTaskPopulated && !this.IsNonADProperty)
         {
             throw new ArgumentException(base.Name + ": Non-calculated properties must have LdapDisplayName", "ldapDisplayName");
         }
     }
     else
     {
         if (this.IsCalculated && base.CustomFilterBuilderDelegate != new CustomFilterBuilderDelegate(ADObject.DummyCustomFilterBuilderDelegate))
         {
             throw new ArgumentException(base.Name + ": Calculated properties should not contain an LdapDisplayName, unless it is the DummyCustomFilterBuilderDelegate.", "ldapDisplayName");
         }
         if (this.IsTaskPopulated)
         {
             throw new ArgumentException(base.Name + ": TaskPopulated properties should not contain an LdapDisplayName.", "ldapDisplayName");
         }
     }
     if (!this.IsMultivalued && !this.IsFilterOnly && !this.IsCalculated && !this.IsMandatory && base.Type == typeof(string) && !string.Empty.Equals(base.DefaultValue))
     {
         throw new ArgumentException(base.Name + ": Non-mandatory string properties must have default value String.Empty. Found " + (base.DefaultValue ?? "<null>"), "defaultValue");
     }
     if (this.IsValidateInFirstOrganization || this.IsDoNotValidate || this.IsBackLink)
     {
         if ((this.IsValidateInFirstOrganization && this.IsDoNotValidate) || (this.IsDoNotValidate && this.IsBackLink) || (this.IsValidateInFirstOrganization && this.IsBackLink))
         {
             throw new ArgumentException(base.Name + ": Only one of the three property definition flags - ValidateInFirstOrganization, DoNotValidate and BackLink can be set in parameter flags");
         }
         if (base.Type != typeof(ADObjectId))
         {
             throw new ArgumentException(base.Name + ": If ValidateInFirstOrganization, DoNotValidate or BackLink is set for parameter flags, the property type MUST be ADObjectId");
         }
     }
     if (this.IsRanged && (!this.IsMultivalued || string.IsNullOrEmpty(this.ldapDisplayName) || !this.IsReadOnly))
     {
         throw new ArgumentException(base.Name + ": Only multivalued non calculated properties can be ranged.");
     }
     if (!string.IsNullOrEmpty(this.ldapDisplayName) && this.IsRanged != this.ldapDisplayName.ToLower().Contains(";range="))
     {
         throw new ArgumentException(base.Name + ": Ranged property needs to define range in ldapName.");
     }
     if (!string.IsNullOrEmpty(shadowLdapDisplayName))
     {
         if (this.IsCalculated || this.IsReadOnly || this.IsFilterOnly || this.IsTaskPopulated || this.IsSoftLinkAttribute)
         {
             throw new ArgumentException(base.Name + ": Calculated, ReadOnly, FilterOnly, SoftLink, or TaskPopulated properties may not have shadows");
         }
         Type type2;
         ADPropertyDefinitionFlags flags2;
         object defaultValue2;
         if (type.GetTypeInfo().IsValueType&& (flags & ADPropertyDefinitionFlags.PersistDefaultValue) == ADPropertyDefinitionFlags.PersistDefaultValue)
         {
             Type typeFromHandle = typeof(Nullable <>);
             type2 = typeFromHandle.MakeGenericType(new Type[]
             {
                 type
             });
             flags2        = (flags & ~ADPropertyDefinitionFlags.PersistDefaultValue);
             defaultValue2 = null;
         }
         else
         {
             type2         = type;
             flags2        = flags;
             defaultValue2 = defaultValue;
         }
         this.shadowProperty = new ADPropertyDefinition(string.Format("Shadow{0}", name), ExchangeObjectVersion.Exchange2003, type2, formatProvider, shadowLdapDisplayName, null, null, flags2, defaultValue2, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, SimpleProviderPropertyDefinition.None, null, null, null, null, null);
     }
     if (!string.IsNullOrEmpty(softLinkLdapDisplayName))
     {
         if (this.IsCalculated || this.IsReadOnly || this.IsFilterOnly || this.IsTaskPopulated)
         {
             throw new ArgumentException(base.Name + ": Calculated, ReadOnly, FilterOnly, or TaskPopulated properties may not have soft links");
         }
         Type typeFromHandle2             = typeof(byte[]);
         ADPropertyDefinitionFlags flags3 = ADPropertyDefinitionFlags.Binary;
         this.softLinkShadowProperty = new ADPropertyDefinition(string.Format("{0}_sl", name), ExchangeObjectVersion.Exchange2003, typeFromHandle2, formatProvider, softLinkLdapDisplayName, null, null, flags3, null, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, SimpleProviderPropertyDefinition.None, null, null, null, null, null);
     }
 }
Ejemplo n.º 6
0
 private static void CheckPropertyDefinitionsForConsistency(ADPropertyDefinition adProp, SimpleProviderPropertyDefinition propertyDefinition, bool checkReadonly = false)
 {
     if (adProp == null)
     {
         throw new ArgumentNullException("adProp");
     }
     if (propertyDefinition == null)
     {
         throw new ArgumentNullException("propertyDefinition");
     }
     if (adProp.Name != propertyDefinition.Name)
     {
         throw new ArgumentException(string.Format("Underlying property definition for ADPropertyDefinition {0} has non-matching name: {1}", adProp.Name, propertyDefinition.Name));
     }
     if (adProp.IsMultivalued != propertyDefinition.IsMultivalued)
     {
         throw new ArgumentException(string.Format("ADPropertyDefinition {0} and underlying property definition must have the same IsMultivalued value", adProp.Name));
     }
     if (adProp.Type != propertyDefinition.Type && adProp.Type != Nullable.GetUnderlyingType(propertyDefinition.Type))
     {
         throw new ArgumentException(string.Format("ADPropertyDefinition {0}: underlying property definition must have either the same Type, or Nullable version of it", adProp.Name));
     }
     if (checkReadonly && adProp.IsReadOnly)
     {
         throw new ArgumentException(string.Format("ADPropertyDefinition {0} has underlying property definition but is read-only", adProp.Name));
     }
 }
Ejemplo n.º 7
0
 // Token: 0x06000A8D RID: 2701 RVA: 0x0002F618 File Offset: 0x0002D818
 public void Add(ConfigurableObjectLogSchema <T, Tschema> .PropertyBase schemaEntry, SimpleProviderPropertyDefinition property)
 {
     schemaEntry.Property = property;
     base.Add(schemaEntry);
 }
Ejemplo n.º 8
0
        // Token: 0x06000A8A RID: 2698 RVA: 0x0002F388 File Offset: 0x0002D588
        private static ConfigurableObjectLogSchema <T, Tschema> .SchemaEntryList ComputeSchemaEntries()
        {
            ConfigurableObjectLogSchema <T, Tschema> .SchemaEntryList schemaEntryList = new ConfigurableObjectLogSchema <T, Tschema> .SchemaEntryList();

            ObjectSchema objectSchema = ObjectSchema.GetInstance <Tschema>();

            foreach (PropertyDefinition propertyDefinition in objectSchema.AllProperties)
            {
                SimpleProviderPropertyDefinition simpleProviderPropertyDefinition = (SimpleProviderPropertyDefinition)propertyDefinition;
                if (simpleProviderPropertyDefinition.IsMultivalued)
                {
                    schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .MultiValuedProperty(), simpleProviderPropertyDefinition);
                }
                else
                {
                    Type type = simpleProviderPropertyDefinition.Type;
                    if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable <>))
                    {
                        type = type.GetGenericArguments()[0];
                    }
                    if (type.IsEnum && type.GetCustomAttributes(typeof(FlagsAttribute), true).Length > 0)
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .SimpleProperty <int>(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(ADObjectId))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .ADObjectIdGuidProperty(), simpleProviderPropertyDefinition);
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .StringProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(int))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .SimpleProperty <int>(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(Unlimited <int>))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .UnlimitedProperty <int, ConfigurableObjectLogSchema <T, Tschema> .SimpleProperty <int> >(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(byte[]))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .SimpleProperty <byte[]>(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(Guid))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .GuidProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(DateTime))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .DateTimeProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(ExDateTime))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .ExDateTimeProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(TimeSpan))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .TimeSpanProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(Unlimited <TimeSpan>))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .UnlimitedProperty <TimeSpan, ConfigurableObjectLogSchema <T, Tschema> .TimeSpanProperty>(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(EnhancedTimeSpan))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .EnhancedTimeSpanProperty(), simpleProviderPropertyDefinition);
                    }
                    else if (type == typeof(Unlimited <EnhancedTimeSpan>))
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .UnlimitedProperty <EnhancedTimeSpan, ConfigurableObjectLogSchema <T, Tschema> .EnhancedTimeSpanProperty>(), simpleProviderPropertyDefinition);
                    }
                    else
                    {
                        schemaEntryList.Add(new ConfigurableObjectLogSchema <T, Tschema> .StringProperty(), simpleProviderPropertyDefinition);
                    }
                }
            }
            return(schemaEntryList);
        }