Category Archives: Informational

MicroLite.Extensions.Mvc 6.3.0

MicroLite.Extensions.Mvc 6.3.0 has been released on NuGet.

The main changes in this release are:

  1. .NET 4.5 only build targeting ASP.NET MVC 5.2.3
  2. MicroLiteSessionAttribute has been removed, it is strongly recommended that you use an IOC container to manage dependencies.

This does mean that the release is not necessarily a “drop-in” update if you were previously using an older version of .NET or ASP.NET MVC.

To see the full set of changes, please refer to the Github release page

MicroLite.Extensions.WebApi 6.5.0

MicroLite.Extensions.WebApi 6.5.0 has been released on NuGet.

The main changes in this release are:

  1. .NET 4.5 only build targeting ASP.NET WebApi 5.2.3 and Net.Http.WebApi.OData 3.4.0
  2. MicroLiteSessionAttribute has been removed, it is strongly recommended that you use an IOC container to manage dependencies.

This does mean that the release is not necessarily a “drop-in” update if you were previously using an older version of .NET or ASP.NET WebApi.

To see the full set of changes, please refer to the Github release page

Logging Extension Updates

The logging extensions for MicroLite have been updated as follows and are available on nuget.org.

log4net

The log4net extension has been updated to target log4net 2.0.5 or later and a .NET 4.6 compiled build has been added.

NLog

The NLog extension has been updated to target NLog 4.4.0 or later and a .NET 4.6 compiled build has been added.

Serilog

The Serilog extension has been updated to target Serilog 2.3.0 or later, a .NET 4.6 compiled build has been added and the .NET 4.0 build has been removed.

Upgrading to MicroLite 6.3

MicroLite 6.3.0 has been released on NuGet, the main changes in this release are detailed below.

New Convention Mappings

There are now 2 new helper convention mappings:

  1. ConventionMappingSettings.LowercaseWithUnderscores – Maps a Pascal Cased property name to an underscore separated lower cased column e.g. a property called ‘CreditCard’ would map to a column called ‘credit_card’
  2. ConventionMappingSettings.UppercaseWithUnderscores – Maps a Pascal Cased property name to an underscore separated upper cased column e.g. a property called ‘CreditCard’ would map to a column called ‘CREDIT_CARD’

DateTime mapping

The default mapping for System.DateTime is now System.Data.DbType.DateTime2. If you need to change it back to System.Data.DbType.DateTime do the following:

// In startup code (before calling Configure.Fluently()...):

// Reset the DbType mapping for DateTime:
TypeConverter.RegisterTypeMapping(typeof(DateTime), DbType.DateTime);
TypeConverter.RegisterTypeMapping(typeof(DateTime?), DbType.DateTime);

XDocument mapping

The default mapping for System.Xml.Linq.XDocument is now System.Data.DbType.Xml. If you need to change it back to System.Data.DbType.String do the following:

// In startup code (before calling Configure.Fluently()...):

// Reset the DbType mapping for XDocument:
TypeConverter.RegisterTypeMapping(typeof(XDocument), DbType.String);

MicroLite 6.3

MicroLite development has been quiet for a while, although I have some plans for version 7.0, they are quite big and as part of that is moving to support .NET Core it’s a way off. In the interim I’m planning another build for version 6 which will pull some of the quicker and easier changes which were waiting for 7.0.

The biggest change will be that the support for databases other than MS SQL will be moved into separate libraries which reference the third party drivers explicitly. The only real impact will be pulling in MicroLite.Database.<DbType> in addition to MicroLite if you use MySQL, PostgreSQL etc.

To see what else is to be included, view the milestone for 6.3

Edit 24 Aug 2016: The split for databases into separate projects will now not happen until MicroLite 7.0 to avoid introducing a breaking change in 6.3

Looking ahead to MicroLite 7.0

You may have noticed that there hasn’t been a lot going on recently with MicroLite, we’ve had a few bug fixes since version 6.2 was released but nothing big. There are 2 main reasons behind that, the first is that I’ve been busy with some other things and the second is that I’ve been thinking about where to take MicroLite next.

There’s nothing concrete at the moment, but the main things I would like to do are:

  • Move to .NET Core
  • Support multiple mapping conventions (similar to how the attribute and convention routing works in ASP.NET Web API)
  • Support immutable and private types
  • Go async only
  • Move the other database providers into separate assemblies which can reference the 3rd party libraries (instead of everything working against DbCommand and DbParameter)
  • Allow custom instance factories
  • Support out parameters from stored procedures
  • Replace the MVC and WebApi extensions with a single AspNet extension for ASP.NET 5 (vNext)

That’s by no means a complete list, if there’s anything you would like to see added or any concerns with anything on that list, please comment here or raise an issue on the GitHub site.

Upgrading to MicroLite 6.2

MicroLite 6.2.0 has been released on NuGet.

The 2 main changes in this release are:

  • The session re-uses the same command during its lifecycle so multiple operations via a session are more efficient – especially multiple operations of the same type (e.g. multiple inserts).
  • Improved the handling of TimeSpan – beware that this is a breaking change (see below)

Prior to MicroLite 6.2, MicroLite was able to map a TimeSpan to a MS SQL Time column – however it turns out there are a number of problems with the Time type:

  1. It has a maximum value of 24:00:00 since it is actually designed to represent the time of day
  2. It cannot be used in some aggregate functions such as SUM and AVERAGE which makes summarising data diffucult

In order to mitigate these issues, MicroLite 6.2 now maps TimeSpan to a BIGINT by persisting the tick count of the TimeSpan – this has the added benefit of also enabling TimeSpan to be used by any database supported by MicroLite.

If you are updating to MicroLite 6.2 and you are currently using TimeSpan -> TIME you have 2 options:

1) – Update your database schema to use a BIGINT (add a new column, populate it by casting the time as the tick count, remove the old column).

2) – Configure MicroLite 6.2 to behave like MicroLite 6.1:

// In startup code (before calling Configure.Fluently()...):

// 1. Remove the new TimeSpanTypeConverter:
var timeSpanTypeConverter = TypeConverter.Converters.OfType<TimeSpanTypeConverter>().Single();
TypeConverter.Converters.Remove(timeSpanTypeConverter);

// 2. Reset the DbType mapping for TimeSpan:
TypeConverter.RegisterTypeMapping(typeof(TimeSpan), System.Data.DbType.Time);
TypeConverter.RegisterTypeMapping(typeof(TimeSpan?), System.Data.DbType.Time);