Class XmlConverterDecoratorExtensions
- Namespace
- Cuemon.Xml.Serialization.Converters
- Assembly
- Cuemon.Xml.dll
Extension methods for the XmlConverter class hidden behind the IDecorator<T> interface.
public static class XmlConverterDecoratorExtensions- Inheritance
- 
      
      XmlConverterDecoratorExtensions
Methods
AddDateTimeConverter(IDecorator<IList<XmlConverter>>)
Adds an DateTime XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddDateTimeConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddEnumerableConverter(IDecorator<IList<XmlConverter>>)
Adds an IEnumerable XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddEnumerableConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddExceptionConverter(IDecorator<IList<XmlConverter>>, bool, bool)
Adds an Exception XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddExceptionConverter(this IDecorator<IList<XmlConverter>> decorator, bool includeStackTrace, bool includeData)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- includeStackTracebool
- The value that determine whether the stack of an exception is included in the converted result. 
- includeDatabool
- The value that determine whether the data of an exception is included in the converted result. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddExceptionDescriptorConverter(IDecorator<IList<XmlConverter>>, Action<ExceptionDescriptorOptions>)
Adds an ExceptionDescriptor XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddExceptionDescriptorConverter(this IDecorator<IList<XmlConverter>> decorator, Action<ExceptionDescriptorOptions> setup)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- setupAction<ExceptionDescriptorOptions>
- The ExceptionDescriptorOptions which need to be configured. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddFailureConverter(IDecorator<IList<XmlConverter>>)
Adds an Failure XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddFailureConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddStringConverter(IDecorator<IList<XmlConverter>>)
Adds an string XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddStringConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddTimeSpanConverter(IDecorator<IList<XmlConverter>>)
Adds an TimeSpan XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddTimeSpanConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddUriConverter(IDecorator<IList<XmlConverter>>)
Adds a Uri XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddUriConverter(this IDecorator<IList<XmlConverter>> decorator)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
AddXmlConverter<T>(IDecorator<IList<XmlConverter>>, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, bool>, XmlQualifiedEntity)
Adds an XML converter to the enclosed IList{XmlConverter} of the specified decorator.
public static IDecorator<IList<XmlConverter>> AddXmlConverter<T>(this IDecorator<IList<XmlConverter>> decorator, Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity qe = null)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- writerAction<XmlWriter, T, XmlQualifiedEntity>
- The delegate that converts - Tto its XML representation.
- readerFunc<XmlReader, Type, T>
- The delegate that generates - Tfrom its XML representation.
- canConvertPredicateFunc<Type, bool>
- The delegate that determines if an object can be converted. 
- qeXmlQualifiedEntity
- The optional XmlQualifiedEntity that will provide the name of the root element. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Type Parameters
- T
- The type of the object to converts to and from XML. 
Exceptions
- ArgumentNullException
- decoratorcannot be null.
FirstOrDefaultReaderConverter(IDecorator<IList<XmlConverter>>, Type)
Returns the first XmlConverter of the enclosed IList{XmlConverter} of the specified decorator that CanConvert(Type) and CanRead the specified objectType; otherwise null if no XmlConverter is found.
public static XmlConverter FirstOrDefaultReaderConverter(this IDecorator<IList<XmlConverter>> decorator, Type objectType)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- objectTypeType
- Type of the object to deserialize. 
Returns
- XmlConverter
- An XmlConverter that can deserialize the specified - objectType; otherwise- null.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
FirstOrDefaultWriterConverter(IDecorator<IList<XmlConverter>>, Type)
Returns the first XmlConverter of the enclosed IList{XmlConverter} of the specified decorator that CanConvert(Type) and CanWrite the specified objectType; otherwise null if no XmlConverter is found.
public static XmlConverter FirstOrDefaultWriterConverter(this IDecorator<IList<XmlConverter>> decorator, Type objectType)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- objectTypeType
- Type of the object to serialize. 
Returns
- XmlConverter
- An XmlConverter that can serialize the specified - objectType; otherwise- null.
Exceptions
- ArgumentNullException
- decoratorcannot be null.
InsertXmlConverter<T>(IDecorator<IList<XmlConverter>>, int, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, bool>, XmlQualifiedEntity)
Inserts an XML converter to the enclosed IList{XmlConverter} of the specified decorator at the specified index.
public static IDecorator<IList<XmlConverter>> InsertXmlConverter<T>(this IDecorator<IList<XmlConverter>> decorator, int index, Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity qe = null)Parameters
- decoratorIDecorator<IList<XmlConverter>>
- The IDecorator{IList{XmlConverter}} to extend. 
- indexint
- The zero-based index at which an XML converter should be inserted. 
- writerAction<XmlWriter, T, XmlQualifiedEntity>
- The delegate that converts - Tto its XML representation.
- readerFunc<XmlReader, Type, T>
- The delegate that generates - Tfrom its XML representation.
- canConvertPredicateFunc<Type, bool>
- The delegate that determines if an object can be converted. 
- qeXmlQualifiedEntity
- The optional XmlQualifiedEntity that will provide the name of the root element. 
Returns
- IDecorator<IList<XmlConverter>>
- A reference to - decoratorafter the operation has completed.
Type Parameters
- T
- The type of the object to converts to and from XML. 
Exceptions
- ArgumentNullException
- decoratorcannot be null.