ASP.NET Identity 2.0 and MariaDB

…I finally made it: ASP.NET Identity 2.0 running with MariaDB! It was more difficult than I expected it to be. I’ve been using EntityFramework with MySQL successfully in my day-time job for over two years now. As I was starting a small toy project at home last week I decided to go the easy route: ASP.NET Web API 2 running in an OWIN application. That was the perfect opportunity for giving ASP.NET Identity 2.0 a shot – instead of rolling my own authentication framework.

I still believe that this choice isn’t bad at all, but I underestimated the cost of getting it to run in a heterogeneous environment (read: not everything is Microsoft technology).

Surprisingly (to me – but hey!) Microsoft is providing an example of how to use MySQL and EntityFramework 6 as a storage provider for ASP.NET Identity 2.0. Sadly the example isn’t working out of the box – at least not in my setup. One aspect is that when they wrote the tutorial the MySQL Connector/NET wasn’t supporting EF Code-first migrations as well as it does nowadays. The second issue was the primary keys in the ASP.NET Identity tables being too long for MySQL.

Continue reading