예제 #1
0
        /// <summary>
        /// Determines whether the specified flag is set.
        /// </summary>
        /// <param name="flag">The flag.</param>
        /// <param name="version">Requested version.</param>
        /// <returns>
        ///     <c>true</c> if the specified flag is set; otherwise, <c>false</c>.
        /// </returns>
        internal override bool HasFlag(PropertyDefinitionFlags flag, ExchangeVersion?version)
        {
            if (version != null && version >= ExchangeVersion.Exchange2010_SP2)
            {
                return((flag & AttachmentsPropertyDefinition.Exchange2010SP2PropertyDefinitionFlags) == flag);
            }

            return(base.HasFlag(flag, version));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : this(xmlElementName, uri, version)
 {
     this.flags = flags;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : this(xmlElementName, uri, version)
 {
     this.flags = flags;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     string uri,
     ExchangeVersion version)
     : base(uri)
 {
     this.xmlElementName = xmlElementName;
     this.flags = PropertyDefinitionFlags.None;
     this.version = version;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ComplexPropertyDefinitionBase"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal ComplexPropertyDefinitionBase(
     string xmlElementName,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ComplexPropertyDefinitionBase"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal ComplexPropertyDefinitionBase(
     string xmlElementName,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base()
 {
     this.xmlElementName = xmlElementName;
     this.flags          = flags;
     this.version        = version;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     string uri,
     ExchangeVersion version)
     : base(uri)
 {
     this.xmlElementName = xmlElementName;
     this.flags          = PropertyDefinitionFlags.None;
     this.version        = version;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal PropertyDefinition(
     string xmlElementName,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base()
 {
     this.xmlElementName = xmlElementName;
     this.flags = flags;
     this.version = version;
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContainedPropertyDefinition&lt;TComplexProperty&gt;"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="containedXmlElementName">Name of the contained XML element.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 /// <param name="propertyCreationDelegate">Delegate used to create instances of ComplexProperty.</param>
 internal ContainedPropertyDefinition(
     string xmlElementName,
     string uri,
     string containedXmlElementName,
     PropertyDefinitionFlags flags,
     ExchangeVersion version,
     CreateComplexPropertyDelegate <TComplexProperty> propertyCreationDelegate)
     : base(xmlElementName, uri, flags, version, propertyCreationDelegate)
 {
     this.containedXmlElementName = containedXmlElementName;
 }
예제 #11
0
 /// <summary>
 /// Determines whether the specified flag is set.
 /// </summary>
 /// <param name="flag">The flag.</param>
 /// <param name="version">Requested version.</param>
 /// <returns>
 ///     <c>true</c> if the specified flag is set; otherwise, <c>false</c>.
 /// </returns>
 internal override bool HasFlag(PropertyDefinitionFlags flag, ExchangeVersion?version)
 {
     if (version.HasValue && (version.Value == ExchangeVersion.Exchange2007_SP1))
     {
         return(AppointmentSchema.MeetingTimeZone.HasFlag(flag, version));
     }
     else
     {
         return(base.HasFlag(flag, version));
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EffectiveRightsPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal EffectiveRightsPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RecurrencePropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal RecurrencePropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskDelegationStatePropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal TaskDelegationStatePropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EffectiveRightsPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal EffectiveRightsPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeZonePropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal TimeZonePropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PermissionSetPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal PermissionSetPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MeetingTimeZonePropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 internal MeetingTimeZonePropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TypedPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 /// <param name="isNullable">Indicates that this property definition is for a nullable property.</param>
 internal TypedPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version,
     bool isNullable)
     : this(
         xmlElementName,
         uri,
         flags,
         version)
 {
     this.isNullable = isNullable;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ComplexPropertyDefinition&lt;TComplexProperty&gt;"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 /// <param name="propertyCreationDelegate">Delegate used to create instances of ComplexProperty.</param>
 internal ComplexPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version,
     CreateComplexPropertyDelegate <TComplexProperty> propertyCreationDelegate)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
     this.propertyCreationDelegate = propertyCreationDelegate;
 }
예제 #21
0
        public static PropertyDefinitionFlags GetDefaultPropertyDefinitionFlagsForType(Type type)
        {
            PropertyDefinitionFlags result = PropertyDefinitionFlags.None;

            if (typeof(ICollection).IsAssignableFrom(type))
            {
                result = PropertyDefinitionFlags.MultiValued;
            }
            else if (type == typeof(int) || type == typeof(long) || type == typeof(ulong))
            {
                result = PropertyDefinitionFlags.PersistDefaultValue;
            }
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="IntPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 /// <param name="isNullable">Indicates that this property definition is for a nullable property.</param>
 internal IntPropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version,
     bool isNullable)
     : base(
         xmlElementName,
         uri,
         flags,
         version,
         isNullable)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DateTimePropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 /// <param name="isNullable">Indicates that this property definition is for a nullable property.</param>
 internal DateTimePropertyDefinition(
     string xmlElementName,
     string uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version,
     bool isNullable)
     : base(
         xmlElementName,
         uri,
         flags,
         version)
 {
     this.isNullable = isNullable;
 }
예제 #24
0
        // Token: 0x06000005 RID: 5 RVA: 0x00002184 File Offset: 0x00000384
        public static ProviderPropertyDefinition GetDefaultPropertyDefinition <T>(string propertyName, PropertyDefinitionConstraint[] constraints)
        {
            if (constraints == null)
            {
                constraints = PropertyDefinitionConstraint.None;
            }
            PropertyDefinitionFlags propertyDefinitionFlags = PropertyDefinitionFlags.None;
            Type typeFromHandle = typeof(T);

            if (typeFromHandle == typeof(int) || typeFromHandle == typeof(uint) || typeFromHandle == typeof(long) || typeFromHandle == typeof(ulong) || typeFromHandle == typeof(ByteQuantifiedSize) || typeFromHandle == typeof(EnhancedTimeSpan) || typeFromHandle == typeof(DateTime))
            {
                propertyDefinitionFlags |= PropertyDefinitionFlags.PersistDefaultValue;
            }
            return(new SimpleProviderPropertyDefinition(propertyName, ExchangeObjectVersion.Exchange2010, typeFromHandle, propertyDefinitionFlags, default(T), constraints, constraints));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComplexPropertyDefinition&lt;TComplexProperty&gt;"/> class.
        /// </summary>
        /// <param name="xmlElementName">Name of the XML element.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="version">The version.</param>
        /// <param name="propertyCreationDelegate">Delegate used to create instances of ComplexProperty.</param>
        internal ComplexPropertyDefinition(
            string xmlElementName,
            PropertyDefinitionFlags flags,
            ExchangeVersion version,
            CreateComplexPropertyDelegate <TComplexProperty> propertyCreationDelegate)
            : base(
                xmlElementName,
                flags,
                version)
        {
            EwsUtilities.Assert(
                propertyCreationDelegate != null,
                "ComplexPropertyDefinition ctor",
                "CreateComplexPropertyDelegate cannot be null");

            this.propertyCreationDelegate = propertyCreationDelegate;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScopedDateTimePropertyDefinition"/> class.
        /// </summary>
        /// <param name="xmlElementName">Name of the XML element.</param>
        /// <param name="uri">The URI.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="version">The version.</param>
        /// <param name="getPropertyDefinitionCallback">The callback that will be used to retrieve the time zone property.</param>
        internal ScopedDateTimePropertyDefinition(
            string xmlElementName,
            string uri,
            PropertyDefinitionFlags flags,
            ExchangeVersion version,
            GetPropertyDefinitionCallback getPropertyDefinitionCallback)
            : base(
                xmlElementName,
                uri,
                flags,
                version)
        {
            EwsUtilities.Assert(
                getPropertyDefinitionCallback != null,
                "ScopedDateTimePropertyDefinition.ctor",
                "getPropertyDefinitionCallback is null.");

            this.getPropertyDefinitionCallback = getPropertyDefinitionCallback;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ScopedDateTimePropertyDefinition"/> class.
        /// </summary>
        /// <param name="xmlElementName">Name of the XML element.</param>
        /// <param name="uri">The URI.</param>
        /// <param name="flags">The flags.</param>
        /// <param name="version">The version.</param>
        /// <param name="getPropertyDefinitionCallback">The callback that will be used to retrieve the time zone property.</param>
        internal ScopedDateTimePropertyDefinition(
            string xmlElementName,
            string uri,
            PropertyDefinitionFlags flags,
            ExchangeVersion version,
            GetPropertyDefinitionCallback getPropertyDefinitionCallback)
            : base(
                xmlElementName,
                uri,
                flags,
                version)
        {
            EwsUtilities.Assert(
                getPropertyDefinitionCallback != null,
                "ScopedDateTimePropertyDefinition.ctor",
                "getPropertyDefinitionCallback is null.");

            this.getPropertyDefinitionCallback = getPropertyDefinitionCallback;
        }
예제 #28
0
 public ABPropertyDefinition(string name, Type type, PropertyDefinitionFlags flags, object defaultValue) : base(name, ExchangeObjectVersion.Exchange2010, type, flags, defaultValue, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None)
 {
     if ((flags & ABPropertyDefinition.UnsupportedFlags) != PropertyDefinitionFlags.None)
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "ABPropertyDefinition '{0}' has unsupported flags '{1}'.", new object[]
         {
             name,
             flags
         }));
     }
     if ((flags & ABPropertyDefinition.MustHaveFlags) != ABPropertyDefinition.MustHaveFlags)
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "ABPropertyDefinition '{0}' has flags '{1}' - '{2}' flags are required.", new object[]
         {
             name,
             flags,
             ABPropertyDefinition.MustHaveFlags
         }));
     }
 }
 /// <summary>
 /// Determines whether the specified flag is set.
 /// </summary>
 /// <param name="flag">The flag.</param>
 /// <param name="version">Requested version.</param>
 /// <returns>
 ///     <c>true</c> if the specified flag is set; otherwise, <c>false</c>.
 /// </returns>
 internal override bool HasFlag(PropertyDefinitionFlags flag, ExchangeVersion? version)
 {
     if (version.HasValue && (version.Value == ExchangeVersion.Exchange2007_SP1))
     {
         return AppointmentSchema.MeetingTimeZone.HasFlag(flag, version);
     }
     else
     {
         return base.HasFlag(flag, version);
     }
 }
 // Token: 0x06000ED4 RID: 3796 RVA: 0x0004719C File Offset: 0x0004539C
 internal static MServPropertyDefinition RawRecordPropertyDefinition(string name, PropertyDefinitionFlags flags = PropertyDefinitionFlags.None)
 {
     return(new MServPropertyDefinition(name, ExchangeObjectVersion.Exchange2003, typeof(MservRecord), flags, null, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, SimpleProviderPropertyDefinition.None, null, null));
 }
 // Token: 0x06000ED2 RID: 3794 RVA: 0x00047154 File Offset: 0x00045354
 internal MServPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, GetterDelegate getterDelegate, SetterDelegate setterDelegate) : base(name, versionAdded, type, flags, defaultValue, readConstraints, writeConstraints, supportingProperties, null, getterDelegate, setterDelegate)
 {
 }
 // Token: 0x06000ED1 RID: 3793 RVA: 0x00047124 File Offset: 0x00045324
 internal MServPropertyDefinition(string name, Type type, PropertyDefinitionFlags flags, object defaultValue, ProviderPropertyDefinition[] supportingProperties, GetterDelegate getterDelegate = null, SetterDelegate setterDelegate = null) : this(name, ExchangeObjectVersion.Exchange2003, type, flags, defaultValue, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, supportingProperties, getterDelegate, setterDelegate)
 {
 }
 public SimpleProviderPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints) : this(name, versionAdded, type, flags, defaultValue, readConstraints, writeConstraints, SimpleProviderPropertyDefinition.None, null, null, null)
 {
 }
예제 #34
0
 private static SimpleProviderPropertyDefinition MakeProperty(string name, ExchangeObjectVersion versionAdded, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints)
 {
     return(new SimpleProviderPropertyDefinition(name, versionAdded, type, flags, defaultValue, readConstraints, writeConstraints));
 }
 public BackgroundJobBackendPropertyDefinition(string name, Type type, PropertyDefinitionFlags flags, object defaultValue) : base(name, ExchangeObjectVersion.Exchange2012, type, flags, defaultValue, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None)
 {
 }
예제 #36
0
 public RegistryPropertyDefinition(string name, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints) : this(name, type, flags, defaultValue, readConstraints, writeConstraints, ProviderPropertyDefinition.None, null, null, null)
 {
 }
예제 #37
0
 internal RegistryPropertyDefinition(string name, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, CustomFilterBuilderDelegate customFilterBuilderDelegate, GetterDelegate getterDelegate, SetterDelegate setterDelegate) : base(name, ExchangeObjectVersion.Exchange2003, type, (defaultValue != null) ? (flags | PropertyDefinitionFlags.PersistDefaultValue) : flags, defaultValue, readConstraints, writeConstraints, supportingProperties, customFilterBuilderDelegate, getterDelegate, setterDelegate)
 {
 }
예제 #38
0
 public XsoDriverPropertyDefinition(StorePropertyDefinition storePropertyDefinition, string name, ExchangeObjectVersion versionAdded, PropertyDefinitionFlags flags, object defaultValue, object initialValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints) : base(name, versionAdded, XsoDriverPropertyDefinition.WrapValueTypeByNullable(storePropertyDefinition.Type), flags, defaultValue, readConstraints, XsoDriverPropertyDefinition.MergeWithXsoConstraints(writeConstraints, storePropertyDefinition))
 {
     this.InitialValue            = initialValue;
     this.StorePropertyDefinition = storePropertyDefinition;
 }
 internal MbxPropertyDefinition(string name, PropTag propTag, ExchangeObjectVersion versionAdded, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, GetterDelegate getterDelegate, SetterDelegate setterDelegate) : base(name, versionAdded, type, flags, defaultValue, readConstraints, writeConstraints, supportingProperties, null, getterDelegate, setterDelegate)
 {
     this.PropTag = propTag;
     if (propTag == PropTag.Null && name == "Null")
     {
         throw new ArgumentException("Name should not be 'Null' is PropTag is Null");
     }
     if (propTag == PropTag.Null != this.IsCalculated)
     {
         throw new ArgumentException("PropTag must be Null IFF Calculated property");
     }
 }
 /// <summary>
 /// Determines whether the specified flag is set.
 /// </summary>
 /// <param name="flag">The flag.</param>
 /// <returns>
 ///     <c>true</c> if the specified flag is set; otherwise, <c>false</c>.
 /// </returns>
 internal bool HasFlag(PropertyDefinitionFlags flag)
 {
     return this.HasFlag(flag, null);
 }
 /// <summary>
 /// Determines whether the specified flag is set.
 /// </summary>
 /// <param name="flag">The flag.</param>
 /// <param name="version">Requested version.</param>
 /// <returns>
 ///     <c>true</c> if the specified flag is set; otherwise, <c>false</c>.
 /// </returns>
 internal virtual bool HasFlag(PropertyDefinitionFlags flag, ExchangeVersion? version)
 {
     return (this.flags & flag) == flag;
 }
        internal SimpleProviderPropertyDefinition(string name, ExchangeObjectVersion versionAdded, Type type, PropertyDefinitionFlags flags, object defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, ProviderPropertyDefinition[] supportingProperties, CustomFilterBuilderDelegate customFilterBuilderDelegate, GetterDelegate getterDelegate, SetterDelegate setterDelegate) : base(name, versionAdded, type, defaultValue, readConstraints, writeConstraints, supportingProperties, customFilterBuilderDelegate, getterDelegate, setterDelegate)
        {
            this.flags = (int)flags;
            Type left = base.Type.GetTypeInfo().IsGenericType ? base.Type.GetTypeInfo().GetGenericTypeDefinition() : null;

            if (typeof(ICollection).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()) && typeof(byte[]) != type && !this.IsKnownFailure(type))
            {
                if (this.IsMultivalued)
                {
                    throw new ArgumentException(base.Name + ": Only specify the element type for MultiValued properties. Type: " + type.FullName, "type");
                }
                throw new ArgumentException(base.Name + ": Instead of specifying a collection type, please mark the property definition as MultiValued and specify the element type as the type Type: " + type.FullName, "type");
            }
            else
            {
                if (this.IsMultivalued && base.DefaultValue != null)
                {
                    throw new ArgumentException(base.Name + ": Multivalued properties should not have default value", "defaultValue");
                }
                if (base.DefaultValue == null && this.PersistDefaultValue)
                {
                    throw new ArgumentException(base.Name + ": Cannot persist default value when no default value is specified.", "defaultValue");
                }
                if (this.IsTaskPopulated)
                {
                    if (this.IsFilterOnly)
                    {
                        throw new ArgumentException(base.Name + ": TaskPopulated properties are not supported as FilterOnly properties at this time.", "flags");
                    }
                    if (this.IsCalculated)
                    {
                        throw new ArgumentException(base.Name + ": TaskPopulated properties should not be marked as calculated.", "flags");
                    }
                    if (this.IsReadOnly || this.IsWriteOnce)
                    {
                        throw new ArgumentException(base.Name + ": TaskPopulated properties must be modifiable from within the task and cannot be marked ReadOnly or WriteOnce.", "flags");
                    }
                }
                if (this.IsWriteOnce && this.IsReadOnly)
                {
                    throw new ArgumentException(base.Name + ": Properties cannot be marked as both ReadOnly and WriteOnce.", "flags");
                }
                if (this.IsMandatory && this.IsFilterOnly)
                {
                    throw new ArgumentException(base.Name + ": Mandatory properties should not be marked FilterOnly.", "flags");
                }
                if (this.IsFilterOnly && this.IsCalculated)
                {
                    throw new ArgumentException(base.Name + ": Calculated properties should not be marked as FilterOnly.", "flags");
                }
                if (!this.IsMultivalued && !this.IsFilterOnly && !this.IsCalculated)
                {
                    Type underlyingType = Nullable.GetUnderlyingType(type);
                    if (base.Type.GetTypeInfo().IsValueType&& left != typeof(Nullable <>) && base.DefaultValue == null)
                    {
                        throw new ArgumentException(base.Name + ": Value type properties must have default value.", "defaultValue");
                    }
                    if (left == typeof(Nullable <>) && base.DefaultValue != null)
                    {
                        throw new ArgumentException(base.Name + ": Default value for a property of Nullable type must be 'null'.", "defaultValue");
                    }
                    if (null != underlyingType && underlyingType.GetTypeInfo().IsGenericType&& underlyingType.GetGenericTypeDefinition() == typeof(Unlimited <>))
                    {
                        throw new ArgumentException(base.Name + ": Properties cannot be both Unlimited and Nullable.", "type");
                    }
                    if (left == typeof(Unlimited <>) && !(bool)base.Type.GetTypeInfo().GetDeclaredProperty("IsUnlimited").GetValue(base.DefaultValue, null))
                    {
                        throw new ArgumentException(base.Name + ": Default value for a property of Unlimited type must be 'unlimited'.", "defaultValue");
                    }
                    if (left == typeof(Unlimited <>) && this.PersistDefaultValue)
                    {
                        throw new ArgumentException(base.Name + ": Cannot persist default value for Unlimited type.", "flags");
                    }
                }
                if (this.IsCalculated != (base.GetterDelegate != null))
                {
                    throw new ArgumentException(base.Name + ": Calculated properties must have GetterDelegate, non-calculated ones must not", "getterDelegate");
                }
                if ((this.IsCalculated && !this.IsReadOnly) != (base.SetterDelegate != null))
                {
                    throw new ArgumentException(base.Name + ": Writable calculated properties must have SetterDelegate, non-calculated & readonly ones must not", "setterDelegate");
                }
                if (this.IsCalculated != (base.SupportingProperties.Count != 0))
                {
                    throw new ArgumentException(base.Name + ": Calculated properties must have supporting properties, non-calculated ones must not", "supportingProperties");
                }
                if (this.IsReadOnly && writeConstraints.Length > 0)
                {
                    throw new ArgumentException(base.Name + ": Readonly properties should not have write-only constraints", "writeConstraints");
                }
                if (base.DefaultValue != null && !this.PersistDefaultValue && !this.IsCalculated && !this.IsTaskPopulated && (base.Type == typeof(int) || base.Type == typeof(uint) || base.Type == typeof(long) || base.Type == typeof(ulong) || base.Type == typeof(ByteQuantifiedSize) || base.Type == typeof(EnhancedTimeSpan) || base.Type == typeof(DateTime)))
                {
                    throw new ArgumentException(string.Format("Property {0} has type {1} and a default value that is not persisted", base.Name, base.Type.ToString()), "flags");
                }
                if (this.IsCalculated && base.Type.GetTypeInfo().IsValueType&& left != typeof(Nullable <>) && base.DefaultValue == null && !this.IsMultivalued)
                {
                    throw new ArgumentException(string.Format("Calculated property {0} has type {1} and no default value", base.Name, base.Type.ToString()), "flags");
                }
                return;
            }
        }
예제 #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ByteArrayPropertyDefinition"/> class.
 /// </summary>
 /// <param name="xmlElementName">Name of the XML element.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="flags">The flags.</param>
 /// <param name="version">The version.</param>
 ByteArrayPropertyDefinition(
     String xmlElementName,
     String uri,
     PropertyDefinitionFlags flags,
     ExchangeVersion version)
     : super(