I'm struggling with a problem when using DependencyResolver.GetService()
inside a method called from UserManager.CreateAsync()
in AspNet.Identity
.
I've added a UserProfile class to the AspNetUser according to this article.
All works fine but when creating a new user it tries to create my UserProfile entity as well and inside this I have an attribute [CheckIfExists]
checks if the UserProfile already exists. In this method, let's call it CheckIfExists()
, I use DependencyResolver.GetService()
to resolve my interface ICheckIfExists
to the "concreate" class CheckIfExists
. This fails since the current thread is not part of the HttpContext (since it's running in CreateAsync():s thread).
Has anyone encountered this problem? Is there a solution for it? I'm using StructureMap for IoC.