Monthly Archives: April 2013

Unit Testing MVC Controllers

If you use the ASP.NET MVC Extension with ASP.NET MVC 4, you may encounter problems running unit tests if you inherit from the MicroLiteController or MicroLiteReadOnlyController.

This is because the MVC Extension for MicroLite is currently built against ASP.NET MVC 3.

Since the Controller classes in ASP.NET MVC 4 are backwards compatible with MVC 3, you can fix this by adding an app.config to your unit test project with a binding redirect for ASP.NET MVC as follows:

  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="" newVersion="" />

What’s coming after 3.0?

It’s been quite a while since 3.0.0 was released, so here’s where MicroLite is headed.

Version 3.1 is currently being worked on and at the moment the intention is to add the following:

  • Enable specifying a table schema in the convention based mapping introduced in 3.0
  • Enable custom type converters – there has been a fair amount of refactoring internally in 3.0 and over the course of the point releases since to get ready for exposing the type conversion API.
  • Enable custom SQL dialects – just like the type converters, the intention has always been to expose the sql dialects for extension.
  • Add a DbEncryptedString class which can be used to automatically decrypt/encrypt data when it is read/written to the database.

We also want to add support for Oracle, Firebird and Sybase however these may not make the 3.1 release and may have to wait until 3.2.

MicroLite 3.0.3 Released

Version 3.0.3 has been released for MicroLite.

The main change is that MicroLite now supports properties which are XDocuments. They can be stored in the database either in an XML column or text column.

public class Thing
    public XDocument Data { get; set; }

Also, the NuGet package contains a copy of the compiled help file.