Using DataContext with IdentityDbContext

Apr 8, 2014 at 1:37 PM
Edited Apr 8, 2014 at 3:13 PM
An increasingly common use case in Asp.Net MVC 5 (with Asp.Net Identity) is to use IdentityDbContext as your base class for your data context, adding your model collections in as properties to your own concrete implementation of IdentityDbContext

This means that this project is, out of the box, incompatible with ASP.NET MVC and WebAPI that use the new Asp.Net Identity frameworks.

However, because these are not core EF components, and there was already a significant change between Identity 1.0 and 2.0, they shouldn't be included in the Repository.Pattern.Ef6 project.

Is it worth adding a separate project to the core that inherits from Repository.Pattern.Ef6 called Repository.Pattern.AspNetIdentity and which provides an implementation of DataContext that inherits IdentityDbContext and the various generic implementations of the same for Identity 2.0?

Apr 9, 2014 at 6:03 PM
Edited Apr 9, 2014 at 6:04 PM
It is probably worth it, since there are a lot of questions around Identity in general, I'll add this to our backlog. If you have any ideas around this or use cases that would be most ideal in real world practice, please share.
Marked as answer by lelong37 on 4/9/2014 at 10:04 AM
Apr 9, 2014 at 6:38 PM
Thanks Le. It is worth noting on this item that Identity 1.0 only provided a single type of IdentityDbContext, but 2.0 now lets you go further and provide the key types as well. I think this may mean 2 different versions may be required, one for each release of Identity so far. There is even potential for more changes in the future, based on this release behaviour. Happy to contribute to the coding, get in touch if you want.