I have read and coding follow example: http://timschreiber.com/2015/01/14/persistence-ignorant-asp-net-identity-with-patterns-part-1/ But that example used Unity for DI, but i'm used Autofac for ID, when i try run my project i have the following error:
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'App.Front.Controllers.HomeController' can be invoked with the available services and parameters: Cannot resolve parameter 'Microsoft.AspNet.Identity.UserManager
2[IdentityStore.IdentityUser,System.Guid] userManager' of constructor 'Void .ctor(Microsoft.AspNet.Identity.UserManager
2[IdentityStore.IdentityUser,System.Guid])'.
My code:
public class IdentityModule : Module
{
protected override void Load(ContainerBuilder builder)
{
//var dbContextParameter = new ResolvedParameter((pi, ctx) => pi.ParameterType == typeof(DbContext),
// (pi, ctx) => ctx.Resolve<AppContext>());
builder.RegisterType<UserStore>().As<IUserStore<IdentityUser, Guid>>().InstancePerLifetimeScope();
builder.RegisterType<RoleStore>().InstancePerLifetimeScope();
}
}
and
private static void SetAutofacContainer()
{
var builder = new ContainerBuilder();
var mainModules = BuildManager.GetReferencedAssemblies().Cast<Assembly>().Where(p => p.ManifestModule.Name.StartsWith("App.")).ToArray();
builder.RegisterControllers(mainModules);
builder.RegisterAssemblyModules(mainModules);
builder.RegisterFilterProvider();
builder.RegisterSource(new ViewRegistrationSource());
builder.RegisterModule(new EFModule());
builder.RegisterModule(new RepositoryModule());
builder.RegisterModule(new IdentityModule());
builder.RegisterModule(new ServiceModule());
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
Any one help me please!.