Esempio n. 1
0
        internal static SmtpAddress GetSmtpAddressProperty(IAnchorStoreObject item, StorePropertyDefinition propertyDefinition)
        {
            string property = AnchorHelper.GetProperty <string>(item, propertyDefinition, false);

            if (string.IsNullOrEmpty(property))
            {
                return(SmtpAddress.Empty);
            }
            return(AnchorHelper.GetSmtpAddress(property, propertyDefinition));
        }
Esempio n. 2
0
        internal static StoreObjectId GetObjectIdProperty(IAnchorStoreObject item, StorePropertyDefinition propertyDefinition, bool required)
        {
            Exception innerException = null;

            try
            {
                byte[] property = AnchorHelper.GetProperty <byte[]>(item, propertyDefinition, required);
                if (property == null)
                {
                    return(null);
                }
                return(MigrationHelperBase.GetStoreObjectId(property));
            }
            catch (CorruptDataException ex)
            {
                innerException = ex;
            }
            throw new InvalidDataException(AnchorHelper.GetPropertyErrorMessage(propertyDefinition, null), innerException);
        }
Esempio n. 3
0
        internal static Fqdn GetFqdnProperty(IAnchorStoreObject item, StorePropertyDefinition propertyDefinition, bool required)
        {
            Exception innerException = null;

            try
            {
                string property = AnchorHelper.GetProperty <string>(item, propertyDefinition, required);
                if (property == null)
                {
                    return(null);
                }
                return(new Fqdn(property));
            }
            catch (FormatException ex)
            {
                innerException = ex;
            }
            throw new InvalidDataException(AnchorHelper.GetPropertyErrorMessage(propertyDefinition, null), innerException);
        }
Esempio n. 4
0
        internal static PersistableDictionary GetDictionaryProperty(IAnchorStoreObject item, PropertyDefinition propertyDefinition, bool required)
        {
            AnchorUtil.ThrowOnNullArgument(item, "item");
            AnchorUtil.ThrowOnNullArgument(propertyDefinition, "propertyDefinition");
            string property = AnchorHelper.GetProperty <string>(item, propertyDefinition, required);

            if (property == null)
            {
                return(null);
            }
            PersistableDictionary result;

            try
            {
                result = PersistableDictionary.Create(property);
            }
            catch (XmlException innerException)
            {
                throw new InvalidDataException(AnchorHelper.GetPropertyErrorMessage(propertyDefinition, property), innerException);
            }
            return(result);
        }
Esempio n. 5
0
        internal static ExDateTime?GetExDateTimePropertyOrNull(IAnchorStoreObject item, StorePropertyDefinition propertyDefinition)
        {
            object property = AnchorHelper.GetProperty <object>(item, propertyDefinition, false);

            return(MigrationHelperBase.GetValidExDateTime(property as ExDateTime?));
        }