//----------------------------------------------------------------------- // // Copyright (c) Andrew Arnott. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOAuth.Messaging { using System; using System.Net.Security; using System.Reflection; /// /// Applied to fields and properties that form a key/value in a protocol message. /// [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)] public sealed class MessagePartAttribute : Attribute { /// /// The overridden name to use as the serialized name for the property. /// private string name; /// /// Initializes a new instance of the class. /// public MessagePartAttribute() { } /// /// Initializes a new instance of the class. /// /// /// A special name to give the value of this member in the serialized message. /// When null or empty, the name of the member will be used in the serialized message. /// public MessagePartAttribute(string name) { this.Name = name; } /// /// Gets or sets the name of the serialized form of this member in the message. /// public string Name { get { return this.name; } set { this.name = string.IsNullOrEmpty(value) ? null : value; } } /// /// Gets or sets the level of protection required by this member in the serialized message. /// public ProtectionLevel RequiredProtection { get; set; } /// /// Gets or sets a value indicating whether this member is a required part of the serialized message. /// public bool IsRequired { get; set; } } }