ProtoBehaviorExtensionElement.cs 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #if FEAT_SERVICEMODEL && PLAT_XMLSERIALIZER && FEAT_SERVICECONFIGMODEL
  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. /// <summary>
  17. /// Gets the type of behavior.
  18. /// </summary>
  19. public override Type BehaviorType => typeof(ProtoEndpointBehavior);
  20. /// <summary>
  21. /// Creates a behavior extension based on the current configuration settings.
  22. /// </summary>
  23. /// <returns>The behavior extension.</returns>
  24. protected override object CreateBehavior() => new ProtoEndpointBehavior();
  25. }
  26. }
  27. #endif