PageRenderTime 79ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Bifrost.WCF/Execution/ContainerServiceBehavior.cs

#
C# | 39 lines | 33 code | 6 blank | 0 comment | 0 complexity | 3892918d41bc7a7cd1e821e9bf701c50 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System.Collections.ObjectModel;
  2. using System.Linq;
  3. using System.ServiceModel;
  4. using System.ServiceModel.Channels;
  5. using System.ServiceModel.Description;
  6. using System.ServiceModel.Dispatcher;
  7. using Bifrost.Execution;
  8. namespace Bifrost.WCF.Execution
  9. {
  10. public class ContainerServiceBehavior : IServiceBehavior
  11. {
  12. IContainer _container;
  13. public ContainerServiceBehavior(IContainer container)
  14. {
  15. _container = container;
  16. }
  17. public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters)
  18. {
  19. }
  20. public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
  21. {
  22. foreach (var endpointDispatcher in
  23. serviceHostBase.ChannelDispatchers.OfType<ChannelDispatcher>().SelectMany(
  24. channelDispatcher => channelDispatcher.Endpoints))
  25. {
  26. endpointDispatcher.DispatchRuntime.InstanceProvider = new ContainerInstanceProvider(_container, serviceDescription.ServiceType);
  27. }
  28. }
  29. public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
  30. {
  31. }
  32. }
  33. }