MicroLite 4.0 Released

MicroLite 4.0.0 has been released on NuGet.


The most important change to be aware of is that the default mapping convention has been changed from the Attribute based mapping convention to the Convention based mapping convention we introduced in 3.0.

If you want to continue using the attribute based mapping, simply tell MicroLite to use it when you configure MicroLite:

    .Extensions() // If used, load any logging extension first.

You will also need to specify this prior to any tests which use the SqlBuilder (see Unit Testing when using the Convention Based Mapping (adjust as necessary to register the attribute based mapping instead).


Another important change and one to be aware of if you have created any custom IListeners, is that they are now managed as singletons rather than an instance per session as was previously the case.

Convention Based Mapping

The convention based mapping has been updated with more configurable support for tweaking the conventions to suit your preferred conventions. There will be a separate blog post detailing the changes.

Projections and Dynamic values

As you will see further in another blog post, the support for projections and dynamic values has been greatly enhanced. The dynamic keyword can now be used with any of the following methods.

ISession.Fetch<dynamic>(); // This is the direct replacement for ISession.Projection()

In addition to this, it is also possible to specify primative types in any method listed above. For example:

var dates = session.Fetch<DateTime>(new SqlQuery("SELECT Date FROM Table"));


The SqlBuilder has been enhanced with a number of new methods, notably enhanced query support for individual columns and also SQL formatting.

.Where("Column").IsLike("FOO%"); // User is responsible for wildcards in LIKE.
.Where("Column").NotIn(1, 2, 3);

It also now supports chaining multiple SQL Functions (Count, Min etc)


There will be a separate blog post going into more detail about these changes.


The method return type for ISession.Update is now bool instead of void.

Inflection Service

The inflection service mentioned in has been re-designed to allow globalization. There is a default implementation of IInflectionService which provides English inflection services (this is the default and currently only behaviour provided) however you can specify your own implementation of IInflectionService to provide support for your own language. See the blog post about the updates to convention based mapping for further information.


The IReadOnlySession.Projection method has been obsoleted and the functionality moved to ISession.Fetch(), the Projection method will be removed in MicroLite 5.0.

Bug Fixes

Issue #206 – Session.Paged errors if the query includes a sub query.
Issue #212 – SqlBuilder.Between and .In are Dialect Specific.
Issue #223 – SqlBuilder Between is not appending AND or OR.
Issue #224 – SqlBuilder SingleColumn predicates not appending AND or OR.
Issue #227 – PagedResults.TotalPages returns incorrect value.
Issue #228 – SqlBuilder.AndWhere and SqlBuilder.OrWhere don’t escape column name.


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s