dependency injection - asp.net identity 2.0 unity not resolving default user store -


I get an exception when trying to configure unity to use unity. I have read this sample boilerplate and I still remember what I am still not clear. What am I doing wrong here?

The current type, System.Data.Common.DbConnection, is an abstract class and can not be created. Are you missing a type mapping? << p>

[ResolutionFailedException: Resolution of dependency fail, type = "myApp.Web.Controllers.AccountController", name = "(none)". The exception came when it was resolved.

Exception: Invalid Operation Exception - The current type, System.Data.Common.DbConnection, is an abstract class and can not be created. Do you miss a type mapping?

At the time of the exception, the container was:

myApp.Web.Controllers.AccountController, resolved the parameter "userManager" to solve (none) constructor myApp.Web.Controllers .AccountController (myApp.Web.Models.ApplicationUserManager userManager) is resolving myApp.Web.Models.ApplicationUserManager, (none) determining the constructor's parameter "store". Application.web.moles.resource user manager (microsoft.appspot.com) .IUserStore 1 [[myApp.Web.DAL.Profiles.ApplicationUser, myApp.Web, version = 1.0.0.0, culture = neutral, public keynote = null] Store) Microsoft solution. Espenet Identy Antiquity Framework User store 1 [myApp.Web.DAL.Profiles.ApplicationUser] (, None)) Solution of the manufacturer's parameter "context" Microsoft.AspNet.Identity.EntityFramework.UserStore 1 [[myApp.Web.DAL.Profiles.ApplicationUser, myApp.Web, version = 1.0.0.0, culture = N eutral, PublicKeyToken = null]] (System.Data.Entity.DbContext Reference) Resolving System.Data.Entity.DbContext, (None) Constructor System.Data.Entity.DbContext parameter "Existing connection" resolution (System.Data. Common.dibconnection current connection, system.data.ntt.in System.Data.Common.DbConnection, (none)

Account Administrator like I have modified it Pre> Public Account Administrator (ApplicationUserManager userManager) {_userManager = userManager; } Private ApplicationUserManager _userManager;

I registered container

  container Registration Type & lt; ApplicationUserManager & gt; (New Hyperkachalic Lifetime Manager); Container. Registration Type & lt; IUserStore & lt; ApplicationUser & gt;, Userstore & lt; ApplicationUser & gt; & Gt; (New hierarchical Lifetime Manager ());  

I think you got a solution, but I think I have One is simple.

You are using the unit framework, right? So your application is almost certainly inherited from DbContext (probably IdentityContext & lt; TUser & gt; ), in which case DbContext Received from). This is ApplicationDbContext in the default template.

In your composition root you can simply enter container.RegisterType & lt; DbContext, ApplicationDbContext & gt; (New hierarchical Lifetime Manager); (Clearly edit it if you are called ApplicationDbContext).

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -