MicroLite Comparison Feedback

I stumbled across this Micro ORM Comparison and thought I’d post my thoughts.

The part about requiring more setup code is correct, whilst PetaPoco can be created as var db = new PetaPoco.Database("sqlite");. MicroLite requires you to create a session factory which in turn will create sessions.

Now it’s a fair point that we do need to write a few more lines of code to set up MicroLite, but it’s worth reviewing why that is. Firstly, you only need to write the setup code once in your application where the application actually starts (Global.asax/ App_Start for a web app or Program.cs for a windows forms/console app etc). Secondly, the actual MicroLite session is exposed via the ISession interface, this allows you to write nicely decoupled and testable code which is using MicroLite – something most other Micro ORM frameworks don’t enable.

The points about the convention based mapping are also worth considering – Yes the default conventions do expect the column names to match the property names (in casing as well). In the example, the foo class is cased using camelCasing rather than PascalCasing for the type name and properties which isn’t the capitalization convention used by the .NET framework. However it’s not so good if users feel that MicroLite is too rigid in this sense in preventing you from defining your own convention or tweaking the default convention as necessary.

The post was based on MicroLite 3.1.1, but it is worth mentioning that in MicroLite 4.0 we introduced much greater control over the conventions so for the example you could leave the database and class casing as camelCase and then override the IsIdentifier method in the convention settings:

new ConventionMappingSettings
{
    // Provide a custom method which checks if the property name
    // is lower case 'id'.
    IsIdentifier = (PropertyInfo propertyInfo) => 
    { 
        return propertyInfo.Name == “id”; 
    }
}

The functionality that MicroLite offers above basic CRUD operations are also worth considering if you are considering Micro ORM frameworks:

  • An API to include additional queries in a single database call.
  • A powerful fluent Sql Builder to build more complex queries at runtime.
  • The ability to Intercept Delete, Insert and Update calls via the IListener interface.
  • The ability to create custom Type converters via the ITypeConverter interface.
  • Custom extensions for ASP.NET MVC and WebAPI.
  • Integration with Log4Net or NLog if you want any log data from MicroLite to be written to your application log and you use either framework (to the flexibility to create your own logging extension)
  • A compiled help file and rich xml documentation for tool tips in Visual Studio.

There’s also the question of performance which I’ll cover in another post.

Advertisements

One thought on “MicroLite Comparison Feedback

  1. Pingback: MicroLite Comparison Feedback pt2 | MicroLite ORM

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s