Skip to content

External creation of ILifetimeScope #10

@srogovtsev

Description

@srogovtsev

I have a particular configuration (i.e., hosting OWIN in plain vanilla asp.net application in IIS) that requires me to "inject" ILifetimeScope from outside OWIN middleware instead of creating it inside. So what I want to have is:

  1. asp.net's Application_BeginRequest creates a per-request lifetime scope and saves it to HttpRequest properties
  2. OWIN injector middleware, instead of creating its own lifetime scope, calls external "factory", which simply extracts lifetime scope from HttpRequest properties
  3. further OWIN pipeline proceeds as before
  4. because lifetime scope was created externally, OWIN injector middleware does not dispose it
  5. asp.net's Application_EndRequest gets lifetime scope from HttpRequest properties and disposes it

Is this a feasible approach? I can provide a create a pull-request for this quite quickly and I don't think this would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions