Im using SimpleInjector in my MVC application. The application is using Identity for Authentication. Im getting an error when I navigate to controllers that use AuthenticationManager in the controller.
The constructor of type ApplicationSignInManager contains the parameter with name 'authenticationManager' and type IAuthenticationManager that is not registered. Please ensure IAuthenticationManager is registered, or change the constructor of ApplicationSignInManager.
Here is what example of what my CompositionRoot looks like.
private static Container RegisterDependencyContainer()
{
var container = new Container();
container.Register<IUserStore<ApplicationUser>>(
() => new UserStore<ApplicationUser>(), Lifestyle.Singleton);
// container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
// container.Register<IUserStore<ApplicationUser>>(
// () => new SignIn<ApplicationUser>(), Lifestyle.Singleton);
// Repositories
var repositoryAssembly = typeof(BootstrapRepository).Assembly;
var repositoryRegistrations = repositoryAssembly
.GetExportedTypes()
.Where(type => type.Namespace == RepositoryNamespace && type.GetInterfaces().Any())
.Select(type => new
{
Interface = type.GetInterfaces().Single(),
Implementation = type
});
foreach (var reg in repositoryRegistrations)
{
container.Register(reg.Interface, reg.Implementation, Lifestyle.Transient);
}
How do I register IAuthenticationManager with SimpleInjector?