Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data / System / Data / DataRelationPropertyDescriptor.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="DataRelationPropertyDescriptor.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 // <owner current="true" primary="true">Microsoft</owner>
6 // <owner current="true" primary="false">Microsoft</owner>
7 // <owner current="false" primary="false">Microsoft</owner>
8 //------------------------------------------------------------------------------
9
10 namespace System.Data {
11     using System.ComponentModel;
12
13     /// <devdoc>
14     ///    <para>[To be supplied.]</para>
15     /// </devdoc>    
16     internal sealed class DataRelationPropertyDescriptor : PropertyDescriptor {
17
18         DataRelation relation;
19
20         internal DataRelation Relation {
21             get {
22                 return relation;
23             }
24         }
25
26         internal DataRelationPropertyDescriptor(DataRelation dataRelation) : base(dataRelation.RelationName, null) {
27             this.relation = dataRelation; 
28         }
29
30         public override Type ComponentType {
31             get {
32                 return typeof(DataRowView);
33             }
34         }
35
36         public override bool IsReadOnly {
37             get {
38                 return false;
39             }
40         }
41
42         public override Type PropertyType {
43             get {
44                 return typeof(IBindingList);
45             }
46         }
47
48         public override bool Equals(object other) {
49             if (other is DataRelationPropertyDescriptor) {
50                 DataRelationPropertyDescriptor descriptor = (DataRelationPropertyDescriptor) other;
51                 return(descriptor.Relation == Relation);
52             }
53             return false;
54         }
55
56         public override Int32 GetHashCode() {
57             return Relation.GetHashCode();
58         }
59
60         public override bool CanResetValue(object component) {
61             return false;
62         }
63
64         public override object GetValue(object component) {
65             DataRowView dataRowView = (DataRowView) component;
66             return dataRowView.CreateChildView(relation);
67         }
68
69         public override void ResetValue(object component) {
70         }
71
72         public override void SetValue(object component, object value) {
73         }
74
75         public override bool ShouldSerializeValue(object component) {
76             return false;
77         }
78     }   
79 }
80