Sunday 31 January 2016

ASP.NET MVC, Identity 2, Sqlite

        Recently I've added users and roles with the Identity 2 support in my ASP.NET MVC project. There were several gotchas that slowed my down considerably. I'll just list them one by one:

Tuesday 26 January 2016

Logging of EF generated queries and errors

I've been working on a small ASP.NET MVC project lately. I've added log4net and configured some basic logging. I haven't set it up for EF. I've wanted to start off with some first entities and a sqlite db. I have been getting the missing column exception from the ef provider. There's a nifty feature in the db context which allows to log all the generated queries and more details on errors/exceptions in EF.

public MyDbContext() : base(ConnectionString)
{            
     this.Database.Log = input => Debug.WriteLine(input);
}

It's really useful when you want to add some logging quickly to see what's going on underneath.