The Labs \ Source Viewer \ SSCLI \ System.ComponentModel \ LookupBindingPropertiesAttribute

  1. //------------------------------------------------------------------------------
  2. // <copyright file="LookupBindingPropertiesAttribute.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. /*
  16. */
  17. namespace System.ComponentModel
  18. {
  19.     using System;
  20.     using System.ComponentModel;
  21.     using System.Diagnostics;
  22.     using System.Security.Permissions;
  23.    
  24.     /// <devdoc>
  25.     /// <para>Specifies the data source and data member properties for a component.</para>
  26.     /// </devdoc>
  27.     [AttributeUsage(AttributeTargets.Class)]
  28.     public sealed class LookupBindingPropertiesAttribute : Attribute
  29.     {
  30.        
  31.         private readonly string dataSource;
  32.         private readonly string displayMember;
  33.         private readonly string valueMember;
  34.         private readonly string lookupMember;
  35.        
  36.         /// <devdoc>
  37.         /// <para>
  38.         /// Initializes a new instance of
  39.         /// the <see cref='System.ComponentModel.LookupBindingPropertiesAttribute'/> class.
  40.         /// </para>
  41.         /// </devdoc>
  42.         public LookupBindingPropertiesAttribute()
  43.         {
  44.             this.dataSource = null;
  45.             this.displayMember = null;
  46.             this.valueMember = null;
  47.             this.lookupMember = null;
  48.         }
  49.        
  50.         /// <devdoc>
  51.         /// <para>
  52.         /// Initializes a new instance of
  53.         /// the <see cref='System.ComponentModel.LookupBindingPropertiesAttribute'/> class.
  54.         /// </para>
  55.         /// </devdoc>
  56.         public LookupBindingPropertiesAttribute(string dataSource, string displayMember, string valueMember, string lookupMember)
  57.         {
  58.             this.dataSource = dataSource;
  59.             this.displayMember = displayMember;
  60.             this.valueMember = valueMember;
  61.             this.lookupMember = lookupMember;
  62.         }
  63.        
  64.         /// <devdoc>
  65.         /// <para>
  66.         /// Gets the name of the data source property for the component this attribute is
  67.         /// bound to.
  68.         /// </para>
  69.         /// </devdoc>
  70.         public string DataSource {
  71.             get { return dataSource; }
  72.         }
  73.        
  74.         /// <devdoc>
  75.         /// <para>
  76.         /// Gets the name of the display member property for the component this attribute is
  77.         /// bound to.
  78.         /// </para>
  79.         /// </devdoc>
  80.         public string DisplayMember {
  81.             get { return displayMember; }
  82.         }
  83.        
  84.         /// <devdoc>
  85.         /// <para>
  86.         /// Gets the name of the value member property for the component this attribute is
  87.         /// bound to.
  88.         /// </para>
  89.         /// </devdoc>
  90.         public string ValueMember {
  91.             get { return valueMember; }
  92.         }
  93.        
  94.         /// <devdoc>
  95.         /// <para>
  96.         /// Gets the name of the member property for the component this attribute is
  97.         /// bound to.
  98.         /// </para>
  99.         /// </devdoc>
  100.         public string LookupMember {
  101.             get { return lookupMember; }
  102.         }
  103.        
  104.         /// <devdoc>
  105.         /// <para>
  106.         /// Specifies the default value for the <see cref='System.ComponentModel.LookupBindingPropertiesAttribute'/>, which is <see langword='null'/>. This
  107.         /// <see langword='static '/>field is read-only.
  108.         /// </para>
  109.         /// </devdoc>
  110.         public static readonly LookupBindingPropertiesAttribute Default = new LookupBindingPropertiesAttribute();
  111.        
  112.         public override bool Equals(object obj)
  113.         {
  114.             LookupBindingPropertiesAttribute other = obj as LookupBindingPropertiesAttribute;
  115.             return other != null && other.DataSource == dataSource && other.displayMember == displayMember && other.valueMember == valueMember && other.lookupMember == lookupMember;
  116.         }
  117.        
  118.         public override int GetHashCode()
  119.         {
  120.             return base.GetHashCode();
  121.         }
  122.     }
  123. }

Developer Fusion