Last active
December 14, 2015 08:19
-
-
Save adilakhter/5057168 to your computer and use it in GitHub Desktop.
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
/// <summary> | |
/// Represents Element to set the ProtectionLevel to different Endpoint using configuration | |
/// </summary> | |
public class MessageSecurityBehaviorElement : BehaviorExtensionElement | |
{ | |
private const string PROTECTION_LEVEL_ELEMENT_NAME = "messageProtection"; | |
public override Type BehaviorType | |
{ | |
get | |
{ | |
return typeof(MessageSecurityBehavior); | |
} | |
} | |
protected override object CreateBehavior() | |
{ | |
return new MessageSecurityBehavior { ProtectionLevel = this.ProtectionLevel }; | |
} | |
[ConfigurationProperty(PROTECTION_LEVEL_ELEMENT_NAME)] | |
public ProtectionLevel ProtectionLevel | |
{ | |
get | |
{ | |
return (ProtectionLevel)base[PROTECTION_LEVEL_ELEMENT_NAME]; | |
} | |
set | |
{ | |
base[PROTECTION_LEVEL_ELEMENT_NAME] = value; | |
} | |
} | |
private ConfigurationPropertyCollection properties = null; | |
protected override ConfigurationPropertyCollection Properties | |
{ | |
get | |
{ | |
if (this.properties == null) | |
{ | |
ConfigurationPropertyCollection propertys = new ConfigurationPropertyCollection(); | |
propertys.Add(new ConfigurationProperty(PROTECTION_LEVEL_ELEMENT_NAME, typeof(ProtectionLevel), null, ConfigurationPropertyOptions.IsRequired)); | |
properties = propertys; | |
} | |
return properties; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment