Created
August 18, 2015 13:00
-
-
Save GregOnNet/1b1e3cd505e79f22c0b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void OnBeginRequest(HttpContextBase context, IWindsorContainer container) | |
{ | |
var parameters = new Arguments(new | |
{ | |
response = context.Response, | |
pdfFormatter = container.Resolve<IFormatPdfResponse>() | |
}); | |
container.Resolve | |
<IDispatchPdfReponses>(parameters) | |
.Listen(); | |
} |
Ich glaube mich zu erinnern, dass Resolve<T>()
ein anonymes Objekt übernehmen kann um Parameter namentlich zu binden. Besser wäre jedoch die API von IFormatPdfResponse
so anzupassen, dass die veränderlichen Parameter (HttpRequest
) als Parameter von Listen
, nicht aber vom ctor
übergeben werden. Dann könnte IFormatPdfResponse
problemlos mit Singleton-Lifesytle laufen.
Hey, super Einfall. Danke!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Intro
IDispatchPdfResonses
implementiert.IFormatPdfResponse
ab.Frage
IFormatPdfResponse
bleibt immer gleich, nur die HttpResponse ändert sich.IFormatPdfResponse
noch mal explizit auflösen muss?//cc @agross