ProtoBehaviorExtensionElement.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #if FEAT_SERVICEMODEL && PLAT_XMLSERIALIZER
  2. using System;
  3. using System.ServiceModel.Configuration;
  4. namespace ProtoBuf.ServiceModel
  5. {
  6. /// <summary>
  7. /// Configuration element to swap out DatatContractSerilaizer with the XmlProtoSerializer for a given endpoint.
  8. /// </summary>
  9. /// <seealso cref="ProtoEndpointBehavior"/>
  10. public class ProtoBehaviorExtension : BehaviorExtensionElement
  11. {
  12. /// <summary>
  13. /// Creates a new ProtoBehaviorExtension instance.
  14. /// </summary>
  15. public ProtoBehaviorExtension()
  16. {
  17. }
  18. /// <summary>
  19. /// Gets the type of behavior.
  20. /// </summary>
  21. public override Type BehaviorType
  22. {
  23. get
  24. {
  25. return typeof(ProtoEndpointBehavior);
  26. }
  27. }
  28. /// <summary>
  29. /// Creates a behavior extension based on the current configuration settings.
  30. /// </summary>
  31. /// <returns>The behavior extension.</returns>
  32. protected override object CreateBehavior()
  33. {
  34. return new ProtoEndpointBehavior();
  35. }
  36. }
  37. }
  38. #endif