diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-18 15:40:17 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-18 15:40:17 -0700 |
commit | 95e418aa02296a93587c4e07b0f3eec8cd379416 (patch) | |
tree | 38c97ac46e3b8e1b141ae6d57e1bfe6a42e2db05 /src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs | |
parent | ea7cae52f40770d1023362dadd234b8038d9e68b (diff) | |
download | DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.zip DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.tar.gz DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.tar.bz2 |
MessageDictionary mostly hooked up and most tests passing.
Diffstat (limited to 'src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs')
-rw-r--r-- | src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs b/src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs new file mode 100644 index 0000000..e5c429e --- /dev/null +++ b/src/DotNetOAuth/Messaging/Reflection/MessagePartAttribute.cs @@ -0,0 +1,47 @@ +//-----------------------------------------------------------------------
+// <copyright file="MessagePartAttribute.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOAuth.Messaging.Reflection {
+ using System;
+ using System.Net.Security;
+ using System.Reflection;
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
+ internal sealed class MessagePartAttribute : Attribute {
+ private bool initialized;
+ private string name;
+
+ internal MessagePartAttribute() {
+ }
+
+ internal MessagePartAttribute(string name) {
+ this.Name = name;
+ }
+
+ public string Name {
+ get { return this.name; }
+ set { this.name = string.IsNullOrEmpty(value) ? null : value; }
+ }
+
+ public ProtectionLevel Signed { get; set; }
+
+ public bool IsRequired { get; set; }
+
+ internal void Initialize(MemberInfo member) {
+ if (member == null) {
+ throw new ArgumentNullException("member");
+ }
+
+ if (!this.initialized) {
+ if (String.IsNullOrEmpty(this.Name)) {
+ this.Name = member.Name;
+ }
+
+ this.initialized = true;
+ }
+ }
+ }
+}
|