Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

TypeConvertersSectionHandler Class

Configuration section handler for the Spring.NET typeConverters config section.

For a list of all members of this type, see TypeConvertersSectionHandler Members .


[Visual Basic]
Public Class TypeConvertersSectionHandler
    Implements IConfigurationSectionHandler
public class TypeConvertersSectionHandler : IConfigurationSectionHandler

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.


Type converters are used to convert objects from one type into another when injecting property values, evaluating expressions, performing data binding, etc.

They are a very powerful mechanism as they allow Spring.NET to automatically convert string-based property values from the configuration file into the appropriate type based on the target property's type or to convert string values submitted via a web form into a type that is used by your data model when Spring.NET data binding is used. Because they offer such tremendous help, you should always provide a type converter implementation for your custom types that you want to be able to use for injected properties or for data binding.

The standard .NET mechanism for specifying type converter for a particular type is to decorate the type with a TypeConverterAttribute, passing the type of the TypeConverter-derived class as a parameter.

This mechanism will still work and is a preferred way of defining type converters if you control the source code for the type that you want to define a converter for. However, this configuration section allows you to specify converters for the types that you don't control and it also allows you to override some of the standard type converters, such as the ones that are defined for some of the types in the .NET Base Class Library.


The following example shows how to configure both this section handler and how to define type converters within a Spring.NET config section:

      <sectionGroup name="spring">
        <section name="typeConverters" type="Spring.Context.Support.TypeConvertersSectionHandler, Spring.Core" />
        <converter for="Spring.Expressions.IExpression, Spring.Core" type="Spring.Expressions.ExpressionConverter, Spring.Core" />
        <converter for="MyTypeAlias" type="MyCompany.MyProject.Converters.MyTypeConverter, MyAssembly" />


Namespace: Spring.Context.Support

Assembly: Spring.Core (in Spring.Core.dll)

See Also

TypeConvertersSectionHandler Members | Spring.Context.Support Namespace | TypeRegistry