Type Converters

MicroLite is designed to be extensible and provides the ITypeConverter interface to allow potentially any type to be converted between a property and database column.

It also uses them itself for some of the built in functionality, the current build of MicroLite contains the following ITypeConverters which are registered by default:

Type Converter Behaviour
DbEncryptedStringTypeConverter * The Type Converter which deals with encrypting the MicroLite.DbEncryptedString class (see the DbEncryptedString post)
EnumTypeConverter The Type Converter which deals with converting enum values to and from the integer values they are stored as in a database.
ObjectTypeConverter This is the ‘default’ Type Converter which will be used if there is no custom converter registered for the type. Internally it uses System.Convert.ChangeType so it actually supports any class for which there is either an implicit or explicit cast, or the type implements System.IConvertible. From MicroLite 5.0+ this is exposed via the TypeConverter.Default property and not returned by TypeConverter.For
UriTypeConverter The Type Converter which deals with converting a Uri to and from a text column in a database.
XDocumentTypeConverter The Type Converter which deals with converting an XDocument to and from a text or xml column in a database.

* Shipped separately in MicroLite.Extensions.Cryptography

For further information about Type Converters, see the Type Converters page on the wiki.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s