MicroLite what’s coming after 5.3?

There are 2 major things we currently want to do.

Firstly, add support for Oracle and Sybase which should pretty much cover all the major database providers.

We currently support (as of MicroLite 5.3):

  • MS SQL 2005/2008/2012/2014
  • MySql 5.5+
  • SQLite 3.7+
  • Postgre SQL 9.2+
  • Firebird 2.5+
  • SQL Server Compact Edition 4.0+

Secondly, add a new async version of the session API (.NET 4.5 only) which supports the async/await features of C# 5.

The .NET 3.5 and 4.0 builds of MicroLite will continue to exist and support the current synchronous API via IReadOnlySession and ISession.

The .NET 4.5 build will add new IAsyncReadOnlySession and IAsyncSession interfaces which will expose the async versions of the API.

e.g.

var customer = await session.SingleAsync<Customer>(1024);

The .NET 4.5 build will also keep the synchronous API to maintain backwards compatibility but we will mark them obsolete (as a warning only) to help make developers aware of the async versions.

The async API will be released in MicroLite 6.0 (see GitHub Milestone). Depending on when the Oracle and Sybase implementations are completed, we may release a 5.4 build of MicroLite containing them or if not they should hopefully be included in 6.0.

MicroLite Impresses Reviewer

The author of this post The Sorry State of .NET ORMs recently got in contact to let me know how impressed he was with MicroLite and that it came out top among all the ORMs he tested.

I won’t re-post his entire review, but here are a few points I appreciated:

MicroLite will actually not only configure much of its use by convention, but also will handle things like opening/closing connections for you, pooling your connections and much, much more.

It’s nice to see convention based mapping we added in an earlier version has helped reduce the setup of a new application and to understand some of the work MicroLite saves you from having to do yourself to get data between your application and database.

The documentation had me up and running in less than 10 minutes from knowing absolutely nothing about the lib

This is great! documentation is always the least fun thing to do as a developer and keeping it up to date and meaningful is always a challenge so it’s nice to know we’re doing a good job.

All in all, I have to admit to being very impressed.

Thank you!

Support for Sequences

Sequences are used in some databases as an alternative to identity or auto increment columns. As of MicroLite 5.3, sequence support has been added for the following databases:

  • MS SQL 2012 or newer
  • Firebird

If you wish to use sequences, you will need to alter how you configure identifiers for mapped classes:

If you use attribute based mapping, change to use IdentifierStrategy.Sequence and also specify the sequence name:

[Column("CustomerId")]
[Identifier(IdentifierStrategy.Sequence, "CustomerIdSequence")]
public int Id { get; set; }

If you use convention based mapping, you will need to specify a convention in the configuration (for example, “ClassName_IdName_Sequence” – e.g. Customer_Id_Sequence):

ResolveSequenceName = (PropertyInfo propertyInfo) =>
{
    return propertyInfo.DeclaringType.Name + "_" + propertyInfo.Name + "_Sequence";
}

That’s all there is to it, MicroLite will take care of assigning the sequence value to the identifier property after performing an Insert (as it does with IdentifierStrategy.DbGenerated).

MicroLite 5.3 Released

MicroLite 5.3.0 has been released on NuGet.

The release mainly focuses on implementing support for database sequences and also an updated dialect which supports the new features in MS SQL 2012 onwards.

In addition, we have improved the SqlBuilder – it now supports In(params SqlQuery[] sqlQueries) and NotIn(params SqlQuery[] sqlQueries).

We covered the changes with examples in the MicroLite 5.3 upcoming features post so see that for further details.

Oracle and Sybase Contribution Request

I have added 2 new branches in the MicroLite repository for Sybase and Oracle as we would like to add support for both to MicroLite.

If anyone has any experience with using either of these databases (and/or) has an installation they can use to develop against – any contributions towards the implementation would be much appreciated.

MicroLite 5.3 upcoming features

MicroLite 5.3 is currently in development, you can see the progress by checking the GitHub 5.3 Milestone

Sequence Columns

The main change in this release is the support for sequence columns as identifiers, this will be supported in the Firebird dialect and also the MS SQL Server dialect.

In order to support the new features in MS SQL Server 2012, we are changing the existing MS SQL Server dialect. The existing dialect will be renamed to MsSql2005 and a new MsSql2012 will be added. As far as the configuration goes, if you use MS SQL Server you will need to change the following method call:

.ForMsSqlConnection("connection name")

to one of the following:

.ForMsSql2005Connection("connection name")
// or
.ForMsSql2012Connection("connection name")

MsSql2005 will work with MS SQL Server 2005 or later, the new MsSql2012 will work with MS SQL Server 2012 or later. In addition to using supporting sequences (as well as still supporting identity), the MsSql2012Dialect also uses the new OFFSET FETCH syntax instead of common table expressions which the 2005 dialect uses.

SQL Builder

The In and NotIn methods on the SqlBuilder now support multiple sub queries which means you can use it like this:

var subOne = new SqlQuery("SOME SQL");
var subTwo = new SqlQuery("SOME SQL");

var parentQuery = SqlBuilder
    .Select("Id", "Firstname", "Surname", "Username")
    .From("Users")
    .Where("Id").In(subOne, SubTwo)
    .ToSqlQuery();

The aim is to have MicroLite 5.3 finished by 17th September and we will hopefully have a beta build out in the next day or two, keep an eye out for it on nuget.org.

MicroLite 5.2 Released

MicroLite 5.2.0 has been released on NuGet.

The release mainly focuses on improving the usability from a query perspective. To that end, we have added support for:

  • Querying results into Tuples
  • Querying results into read-only pocos

In addition, we have added extra methods to the SqlBuilder and made a couple of minor refinements to the dynamic IL generation.

We covered the changes with examples in the MicroLite 5.2 upcoming features post so see that for further details.