I was at Umbraco UK Festival 2015 in London a few weeks ago to give a talk on Profiling .NET Server Applications. It was a really great experience for me as this was my first time presenting on this topic which I love and enjoy very much. Also, the conference venue was a church which made it really interesting for a presentation and I would be lying if I tell you that I didn’t feel like a deacon up there on the stage :) The fantastic news is that all sessions were recorded and all of them are available to watch now including my Profiling .NET Server Applications talk:
You can find the slides under my Speaker Deck account and I also encourage you to download the free e-book which gives you 52 quick tips and tricks for .NET application performance:
Finally, here are some further resources to look at if the talk was interesting for you:
- ANTS Performance Profiler and ASP.NET 5
- ASP.NET 5 Log Correlation
- Assembly Memory Leak Sample
- Memory Profiling an Application on IIS
- Performance Counters with PowerShell
- Everything you need to know about .NET memory
- Diving into Diagnostics on ASP.NET 5
- Logstash Input Plugins
- Logstash Output Plugins
As with everything, ASP.NET Identity will have a new version with ASP.NET 5 which is going to be version 3.0.0. There are some changes on the interfaces but it’s not as drastic as others. By default, it provides Entity Framework implementation which I assume going to be compatible with any data storage system that can plug into Entity Framework (which is good). However, you need to provide a custom implementation if you want to support a data storage system which doesn’t support Entity Framework. MongoDB is one of them and I gave it shot to implement ASP.NET Identity MongoDB store. The result was really good:
Library is available on NuGet as Dnx.Identity.MongoDB package and it supports beta8 runtime release. For now, it’s part of a sample project I am working on but it will probably make it into its own repository soon. I also have a sample here which is the fork of the original Identity sample. You can look at this commit to see what I had to do to make it support my custom provider which is not that bad, if you ignore the dependency injection dance I had to make. That’s because my implementation of ASP.NET Identity library doesn’t support IRoleStore. Don’t worry, you will not need this as you already have IUserClaimStore and also, there is an open issue to change the dependency injection hook a bit so that the IRoleStore would be optional.
Here are a few more details about this ASP.NET 5 Identity MongoDB implementation:
- Currently, there is no documentation.
- MongoUserStore is thread safe. You can register this as a singleton.
- At the moment, there is no logging and nice exception handling for the implementation.
- The implementation only supports dnx452 or above and it doesn’t support corefx as MongoDB .NET Client has no support for that.
- The library doesn’t support SetUserNameAsync as the user name is also the Id of the user. So, you cannot change the Id.
- The implementation requires you to pass an implementation of IMongoDatabase through the constructor and it persists data into a collection which is named "users". There is going to be a way to change the name of the collection soon in upcoming releases.
- E-mail uniqueness is ensured through a unique MongoDB index. However, this will not function properly if you shard the users collection.
- The implementation doesn’t persist changes unless you call one of the UpdateAsync, CreateAsync or DeleteAsync methods (which is what UserManager does).
Give it a try and you can file issues here for now and send pull requests. Enjoy :)