How to configure OwinContext Authentication in SimpleInjector 3.3.2?

2

In my current application I use SimpleInjector 3.2.0 with a configuration similar to this:

var container = new Container();
container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();

container.Register<IUserStore<Usuario>>(() => 
    new UserStore<Usuario>(container.GetInstance<IContext>() as DbContext), 
    Lifestyle.Scoped);

container.Register<AppUserManager>(Lifestyle.Scoped);
container.Register<AppSignInManager>(Lifestyle.Scoped);

// demais serviços
SimpleInjectorContainer.RegisterServices(container);

container.RegisterPerWebRequest(() =>
{
    if (HttpContext.Current != null && 
        HttpContext.Current.Items["owin.Environment"] == null && 
        container.IsVerifying())
        return new OwinContext().Authentication;

    return HttpContext.Current.GetOwinContext().Authentication;
});

container.RegisterMvcControllers(Assembly.GetExecutingAssembly());

container.RegisterMvcIntegratedFilterProvider();
container.Verify();

DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));

I know that this snippet for OwinContext Authentication configuration is obsolete. How to configure it with SimpleInjector 3.3.2?

And this setting for the IUserStore < & gt ;. I'm using the container itself to get an instance of DbContext. Go through Verify (), but am I actually getting the instance of IUserStore < > by this setting?

Does anything else change to version 3.3.2? I'm using .Net 4.6.1

    
asked by anonymous 26.01.2017 / 22:44

0 answers