Category Archives: Update

MicroLite 6.3.1

MicroLite 6.3.1 has been released and it is strongly recommended that anyone using 6.3.0 upgrades immediately.

A defect has been identified in 6.3.0 whereby the Identifier value of a newly inserted record isn’t set on the object. This was inadvertently introduced when the Listener code was refactored in 6.3.0 so it only affects that version which has now been hidden on


MicroLite.Extensions.WebApi – Not just for IIS

We released MicroLite.Extensions.WebApi 4.0 a few days ago.

One of the changes which you may not have noticed is that we now only depend on Microsoft.AspNet.WebApi.Client instead of Microsoft.AspNet.WebApi.WebHost.

This allows you to use the extension in either an IIS Hosted or Self Hosted application.

MicroLite 5.0 MiniProfiler support

Along with the release of MicroLite 5.0, we have added an extension to integrate with the StackExchange MiniProfiler.

It’s simple to use, install the NuGet package:

Install-Package MicroLite.Extensions.MiniProfiler

Which will pull down the StackExchange MiniProfiler, and also add the extension method to wire it up for MicroLite in your configuration:

    .Extensions() // If you are also using a logging extension, that should be loaded first.

After that, follow the instructions for starting and saving profile results (and optionally viewing them in an MVC app) on the website at

Version 1.0 of the extension configures MicroLite to use the profiled database commands, in future versions we may look to add additional timings for core MicroLite functionality.

MicroLite 5.0 Released

MicroLite 5.0.0 has been released on NuGet.


MicroLite 5.0 contains a number of changes and enhancements, many of which have been detailed in previous posts:

In addition to these, there are a number of internal changes to improve the performance of MicroLite and reduce its memory footprint.

Upgrading to 5.0

Firstly, if you didn’t use the new configuration method introduced in MicroLite 4.0.1 for configuring a connection, change to use it:


Secondly, the SqlBuilder class has moved from MicroLite.Query to MicroLite.Builder so you will need to change any using MicroLite.Query; statements to using MicroLite.Builder; and any calls to MicroLite.Query.SqlBuilder to MicroLite.Builder.SqlBuilder if you have them fully qualified. A simple find and replace on “MicroLite.Query” to “MicroLite.Builder” should be sufficient.

Thirdly, the deprecated Projection(SqlQuery) method on IReadOnlySession/ISession has been removed, use Fetch<dynamic>(SqlQuery) instead as noted in MicroLite 4.0 – Changes to Projections and Dynamics.

The Wiki wiki page has also been improved with more details and examples – please check it out!

MicroLite 5.0 – String Handling

In .NET, strings are Unicode, however some databases have specific data types for strings which differentiate between ASCII and Unicode (e.g. in MS SQL Server VarChar being ASCII and NVarChar being Unicode).

If the database makes the distinction and the wrong type is used in a SQL command, it can result in poor performing queries (table scans over index lookups or unnecessary type conversion).

In MicroLite 5.0, the database connection/command handling has been exposed via a ‘database driver’. The new IDbDriver interface defines a HandleStringsAsUnicode property which is set to true by default but allows explicit control over whether strings are sent to the database as ASCII or Unicode (the default).

If you use MS SQL Server and the columns are NVarChar, HandleStringsAsUnicode should be left as true (the default value). If they are VarChar, HandleStringsAsUnicode should be set to false.

For other databases, refer to the documentation and if in doubt, leave it set to true.

If you need to, you can set HandleStringsAsUnicode to false when the session factory is created:

var sessionFactory = Configure.Fluently()

// Only change this if you are sure you need to.
sessionFactory.DbDriver.HandleStringsAsUnicode = false;