summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs
blob: 5386314543f9834ae56ac49e4a33a2909beea47a (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
//-----------------------------------------------------------------------
// <copyright file="HostNameElement.cs" company="Outercurve Foundation">
//     Copyright (c) Outercurve Foundation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.Configuration {
	using System.Configuration;

	/// <summary>
	/// Represents the name of a single host or a regex pattern for host names.
	/// </summary>
	internal class HostNameElement : ConfigurationElement {
		/// <summary>
		/// Gets the name of the @name attribute.
		/// </summary>
		private const string NameConfigName = "name";

		/// <summary>
		/// Initializes a new instance of the <see cref="HostNameElement"/> class.
		/// </summary>
		internal HostNameElement() {
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="HostNameElement"/> class.
		/// </summary>
		/// <param name="name">The default value of the <see cref="Name"/> property.</param>
		internal HostNameElement(string name) {
			this.Name = name;
		}

		/// <summary>
		/// Gets or sets the name of the host on the white or black list.
		/// </summary>
		[ConfigurationProperty(NameConfigName, IsRequired = true, IsKey = true)]
		////[StringValidator(MinLength = 1)]
		public string Name {
			get { return (string)this[NameConfigName]; }
			set { this[NameConfigName] = value; }
		}
	}
}