autofac / Autofac.Owin

OWIN integration for Autofac
MIT License
23 stars 15 forks source link

Allow multiple copies of the middleware on the same OWIN pipeline #2

Closed huysentruitw closed 9 years ago

huysentruitw commented 9 years ago

Transparent fix for #1

tillig commented 9 years ago

I've asked for some clarification on #1 since multiple copies of the middleware doesn't imply multiple request lifetime scopes. Is the desired end result multiple middlewares + one request lifetime; or multiple middlewares + one request scope per middleware instance? Just to make sure this addresses the issue.

I like the solution, though - it's nice and tidy.

tillig commented 9 years ago

I'm going to pull this in and publish it to MyGet for testing prior to pushing to NuGet officially.

alexmg commented 9 years ago

Do you get a chance to test this @huysentruitw?

huysentruitw commented 9 years ago

Until now, I failed to create a NuGet package that ILmerges those assemblies (lacking experience :p). Maybe @brockallen is better placed to perform this test directly in IdentityServer?

huysentruitw commented 9 years ago

I would not release this PR in the official library yet. While this fixes the setup of different copies of the assembly, there still is an issue with Autofac.Owin when you use it twice on the same pipeline:

app.Map("/a", appA => appA.UseWhateverA());
app.Map("/b", appB => appB.UseWhateverB());

Now, when both middlewares use Autofac.Owin while sharing the same Autofac.Owin library, only the first one gets registered correctly. This should be fixed IMO as it breaks the pluggable nature of OWIN and we don't want to drop Autofac as IoC container just yet :)

tillig commented 9 years ago

For reference (i.e., next time I'm looking in here) this discussion is continued over on issue #2.