- When googling for answers and checking stack overflow it's easy to find answers concerning either Identity 1 or Identity 2. Bear in mind it's easy to jumble them together.
- The db structure for each version is different and if we're not generating the db structure code first style, we need to know exactly what the structure is. I was using Identity 2 with sqlite. Following is the db creation script I've used on github:
https://github.com/simonkatanski/Identity2SqliteScript/blob/master/Identity2SqliteDbScript.sql - Owin comes with an IAppBuilder which is used in many examples. It uses a dependency resolver to resolve User and Role services, acts as a inversion of control container. If we are using a separate container ( and I'm using unity ) this can lead to dbcontext errors.
Following links were really helpful in getting it setup the way it should:
http://stackoverflow.com/questions/24391885/how-to-plug-my-autofac-container-into-asp-net-identity-2-1
http://tech.trailmax.info/2014/09/aspnet-identity-and-ioc-container-registration/
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.
It's really useful when you want to add some logging quickly to see what's going on underneath.
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.
Subscribe to:
Posts (Atom)