blob: 91053b6c8e5011e92196f69635b3c9ffa401b22f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
//-----------------------------------------------------------------------
// <copyright file="MessagePartAttribute.cs" company="Andrew Arnott">
// Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace DotNetOAuth.Messaging {
using System;
using System.Net.Security;
using System.Reflection;
/// <summary>
/// Applied to fields and properties that form a key/value in a protocol message.
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class MessagePartAttribute : Attribute {
/// <summary>
/// The overridden name to use as the serialized name for the property.
/// </summary>
private string name;
/// <summary>
/// Initializes a new instance of the <see cref="MessagePartAttribute"/> class.
/// </summary>
public MessagePartAttribute() {
}
/// <summary>
/// Initializes a new instance of the <see cref="MessagePartAttribute"/> class.
/// </summary>
/// <param name="name">
/// 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.
/// </param>
public MessagePartAttribute(string name) {
this.Name = name;
}
/// <summary>
/// Gets or sets the name of the serialized form of this member in the message.
/// </summary>
public string Name {
get { return this.name; }
set { this.name = string.IsNullOrEmpty(value) ? null : value; }
}
/// <summary>
/// Gets or sets the level of protection required by this member in the serialized message.
/// </summary>
public ProtectionLevel RequiredProtection { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this member is a required part of the serialized message.
/// </summary>
public bool IsRequired { get; set; }
}
}
|