SkillAgentSearch skills...

OWIN.Windsor.DependencyResolverScopeMiddleware

Creates a Windsor dependency scope per OWIN WebAPI request allowing to use a per request lifestyle component registration in a self-host environment.

Install / Use

/learn @BredStik/OWIN.Windsor.DependencyResolverScopeMiddleware
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

OWIN.Windsor.DependencyResolverScopeMiddleware

Creates a Windsor dependency scope per OWIN WebAPI request allowing to use a per request lifestyle component registration in a self-host environment.

Usage

  1. Add the "OWIN.Windsor.DependencyResolverScopeMiddleware" nuget package to your OWIN self-hosted WebAPI project.
  2. In your Startup.cs file, add "using OWIN.Windsor.DependencyResolverScopeMiddleware;" and configure your Windsor container.
  3. Configure any "per request" component using the "LifestyleScoped" lifestyle.
  4. Use the following line to configure you app by passing in the HttpConfiguration and the container (where app: IAppBuilder): app.UseWindsorDependencyResolverScope(config, container).UseWebApi(config);

Your scoped components will by created once per request and disposed at the end of it automatically.

If you ever need to use the dependency resolver inside a subsequent middleware, just use the "GetDependencyResolver" extension method on the IOwinContext from the "OWIN.Windsor.DependencyResolverScopeMiddleware" namespace.

Related Skills

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated1y ago
Forks1

Languages

C#

Security Score

75/100

Audited on Jul 30, 2024

No findings