internal static T Deserialize <T>(string serializedXML, PropertyDefinition configXmlRawProperty) where T : class { return(XMLSerializableBase.DeserializeFromStringInternal <T>(serializedXML, delegate(Exception e) { throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty(configXmlRawProperty.Name, e.Message), configXmlRawProperty, serializedXML), e); })); }
internal static ADPropertyDefinition ConfigurationXmlProperty <T>(ADPropertyDefinition configXmlRawProperty) where T : XMLSerializableBase { return(new ADPropertyDefinition("ConfigurationXML", ExchangeObjectVersion.Exchange2003, typeof(T), null, ADPropertyDefinitionFlags.Calculated, null, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, new ProviderPropertyDefinition[] { configXmlRawProperty }, null, XMLSerializableBase.ConfigurationXMLGetterDelegate <T>(configXmlRawProperty), XMLSerializableBase.ConfigurationXMLSetterDelegate <T>(configXmlRawProperty), null, null)); }
private static T DeserializeFromStreamInternal <T>(Stream stream, Action <Exception> failureAction) where T : class { T result; using (StreamReader streamReader = new StreamReader(stream)) { result = XMLSerializableBase.DeserializeFromTextReaderInternal <T>(streamReader, failureAction); } return(result); }
private static T DeserializeFromStringInternal <T>(string serializedXML, Action <Exception> failureAction) where T : class { if (string.IsNullOrWhiteSpace(serializedXML)) { return(default(T)); } T result; using (StringReader stringReader = new StringReader(serializedXML)) { result = XMLSerializableBase.DeserializeFromTextReaderInternal <T>(stringReader, failureAction); } return(result); }
internal static ADPropertyDefinition ConfigXmlProperty <T, ValueT>(string propertyName, ExchangeObjectVersion propertyVersion, ADPropertyDefinition configXmlProperty, ValueT defaultValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints, Func <T, ValueT> getterDelegate, Action <T, ValueT> setterDelegate, SimpleProviderPropertyDefinition mservPropertyDefinition = null, SimpleProviderPropertyDefinition mbxPropertyDefinition = null) where T : XMLSerializableBase, new() { ADPropertyDefinitionFlags adpropertyDefinitionFlags = ADPropertyDefinitionFlags.Calculated; if (setterDelegate == null) { adpropertyDefinitionFlags |= ADPropertyDefinitionFlags.ReadOnly; } return(new ADPropertyDefinition(propertyName, propertyVersion, typeof(ValueT), null, adpropertyDefinitionFlags, defaultValue, readConstraints, writeConstraints, configXmlProperty.SupportingProperties.ToArray <ProviderPropertyDefinition>(), null, XMLSerializableBase.XmlElementGetterDelegate <T, ValueT>(getterDelegate, configXmlProperty, defaultValue), (setterDelegate != null) ? XMLSerializableBase.XmlElementSetterDelegate <T, ValueT>(setterDelegate, configXmlProperty) : null, mservPropertyDefinition, mbxPropertyDefinition)); }
internal static ADPropertyDefinition ConfigXmlProperty <T, ValueT>(string propertyName, ExchangeObjectVersion propertyVersion, ADPropertyDefinition configXmlProperty, ValueT defaultValue, Func <T, ValueT> getterDelegate, Action <T, ValueT> setterDelegate, SimpleProviderPropertyDefinition mservPropertyDefinition = null, SimpleProviderPropertyDefinition mbxPropertyDefinition = null) where T : XMLSerializableBase, new() { return(XMLSerializableBase.ConfigXmlProperty <T, ValueT>(propertyName, propertyVersion, configXmlProperty, defaultValue, PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None, getterDelegate, setterDelegate, mservPropertyDefinition, mbxPropertyDefinition)); }