Dependency Injection and AspNet.Identity

34 views
Skip to first unread message

Ingo

unread,
Mar 18, 2014, 3:44:36 PM3/18/14
to sharp...@googlegroups.com
Hi,

I'm struggling with a problem in HasUniqueDomainSignatureAttribute() when the call to DependencyResolver.Current.GetService<IEntityDuplicateChecker>() is made (it returns null though I registered it in ObjectFactory.Initialize())

I've added a UserProfile class to the AspNetUser according to this article. The UserProfile inherits from base class Entity and I have the attribute [HasUniqueDomainSignature] on UserProfile.


The problem occurs when I for example use AspNet.Identity:s CreateAsync() method which in turn calls HasUniqueDomainSignatureAttribute(). CreateAsync() runs in a separate thread outside of the http context and I think it creates the problem.

Has anyone encountered the same problem or has any suggestion how to solve it?

Thanks,

Ingo


Billy McCafferty

unread,
Mar 20, 2014, 6:21:45 PM3/20/14
to sharp...@googlegroups.com
Hi Ingo,

Whenever I need to do something async, I send a fire (and forget) request to a web page that will do the said process.  That might sound klugy, but it's much simpler than trying to work with the same DB context in the async thread.  Perhaps someone has a better idea?

Billy McCafferty


--
You received this message because you are subscribed to the Google Groups "S#arp Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharp-lite+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ingo

unread,
Mar 21, 2014, 5:05:40 PM3/21/14
to sharp...@googlegroups.com
Hi Billy,

Ok, I've never thought of that. Thanks for your help!

/Ingo
Reply all
Reply to author
Forward
0 new messages