Created
February 25, 2011 00:15
-
-
Save duarten/843182 to your computer and use it in GitHub Desktop.
An WCF HTTP configuration DSL
This file contains 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
static IProcessorProvider GetProcessorProvider() | |
{ | |
return new ProcessorProviderFor<TheService>() | |
.RemoveDefaultMediaTypeProcessors() | |
.OnAllOperations(_ => _ | |
.Use(typeof(DataValidationProcessor)) | |
.UseForRequests(typeof(RequestLoggingProcessor))) | |
.OnGetOperation(_ => _ | |
.UseForResponses(typeof(ImageFromTextMediaProcessor), | |
typeof(WaveFromTextMediaProcessor))) | |
.OnOperation(o => o.GetTime(default(HttpRequestMessage), | |
default(HttpResponseMessage)), _ => _ | |
.UseForRequests((o, l, m) => new JsonProcessor(o, m))); | |
} | |
static IProcessorProvider GetProcessorProvider2() | |
{ | |
return new ProcessorProviderFor<TheService>() | |
.RemoveDefaultMediaTypeProcessors() | |
.OnAllOperations(() => | |
Use.ForRequestsAndResponses(typeof(DataValidationProcessor)) | |
.ForRequests(typeof(RequestLoggingProcessor))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment