Mugen Injection [WCF extensions]
When you create your WCF service you can register some extensions like ServiceBehavior, ReleaseInstanceBehavior, DispatchMessageInspector, EndPointBehavior.
This code shows how it works:
protected override void Configure(IApplicationConfiguration applicationConfiguration) { applicationConfiguration .WithHttpConfiguration() .WithWcfConfiguration() //Adding log behavior only to LoggingTimeService. .WithDispatchMessageInspector(syntax => syntax.To<LogMessageInspector>() .WhenInto<LoggingTimeService>().InSingletonScope()) //Adding custom release instance behavior. .WithReleaseInstanceBehavior(syntax => syntax.To<CustomReleaseBehavior>() .InSingletonScope()) //Adding custom service behavior to all services. .WithServiceBehavior(syntax => syntax.To<EmptyServiceBehavior>() .InSingletonScope()) //Adding custom endpoint behavior to NoLoggingTimeService services. .WithEndPointBehavior(syntax => syntax.To<EmptyEndPointBehavior>() .WhenInto<NoLoggingTimeService>().InSingletonScope()) //You can filter message inspector use EndpointDispatcher. .WithDispatchMessageInspector(syntax => syntax .ToMethod<IDispatchMessageInspector>(context => null) .When(context => { var endpointDispatcher = (EndpointDispatcher)context .SpecialParameters[WcfConfigExtension.EndpointDispatcherParameterKey]; return false; })) //You can filter service behaviors use ServiceDescription. .WithServiceBehavior(syntax => syntax .ToMethod<IServiceBehavior>(context => null) .When(context => { var serviceDescription = (ServiceDescription)context .SpecialParameters[WcfConfigExtension.ServiceDescriptionParameterKey]; return false; })) //You can filter end point behaviors use ServiceEndpoint. .WithEndPointBehavior(syntax => syntax .ToMethod<IEndpointBehavior>(context => null) .When(context => { var serviceDescription = (ServiceEndpoint)context .SpecialParameters[WcfConfigExtension.ServiceEndpointParameterKey]; return false; })); }