1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //------------------------------------------------------------
4 
5 using System.Configuration;
6 
7 
8 namespace System.IdentityModel.Configuration
9 {
10 #pragma warning disable 1591
11     /// <summary>
12     /// A collection of SecurityTokenHandlerElementCollection objects.
13     /// </summary>
14     [ConfigurationCollection( typeof( SecurityTokenHandlerElementCollection ), AddItemName = ConfigurationStrings.SecurityTokenHandlers, CollectionType = ConfigurationElementCollectionType.BasicMap )]
15     public sealed partial class SecurityTokenHandlerSetElementCollection : ConfigurationElementCollection
16     {
SecurityTokenHandlerSetElementCollection()17         public SecurityTokenHandlerSetElementCollection()
18         {
19         }
20 
21         protected override bool ThrowOnDuplicate
22         {
23           get
24            {
25              return true;
26            }
27         }
28 
CreateNewElement()29         protected override ConfigurationElement CreateNewElement()
30         {
31             return new SecurityTokenHandlerElementCollection();
32         }
33 
GetElementKey( ConfigurationElement element )34         protected override object GetElementKey( ConfigurationElement element )
35         {
36             return ( (SecurityTokenHandlerElementCollection)element ).Name;
37         }
38 
BaseAdd(ConfigurationElement element)39         protected override void BaseAdd(ConfigurationElement element)
40         {
41             string name = GetElementKey(element) as string;
42             SecurityTokenHandlerElementCollection result = base.BaseGet(name) as SecurityTokenHandlerElementCollection;
43 
44             if (result != null)
45             {
46                 throw DiagnosticUtility.ThrowHelperInvalidOperation(SR.GetString(SR.ID7029, "<securityTokenHandlers>", name));
47             }
48 
49             base.BaseAdd(element);
50          }
51 
52         /// <summary>
53         /// Returns a value indicating whether this element has been configured with non-default values.
54         /// </summary>
55         public bool IsConfigured
56         {
57             get
58             {
59                 return ( Count > 0 );
60             }
61         }
62     }
63 #pragma warning restore 1591
64 }
65