c036a9c0e7c2462330b86b80ea791bdb140e4dbd
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Metadata / Edm / Documentation.cs
1 //---------------------------------------------------------------------
2 // <copyright file="Documentation.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner       Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9
10 using System;
11 using System.Collections.Generic;
12 using System.Data.Common;
13 using System.Diagnostics;
14 using System.Globalization;
15 using System.Text;
16 using System.Data.Common.Utils;
17
18 namespace System.Data.Metadata.Edm
19 {
20     /// <summary>
21     /// Class representing the Documentation associated with an item
22     /// </summary>
23     public sealed class Documentation: MetadataItem
24     {
25         #region Fields
26         private string _summary = "";
27         private string _longDescription = "";
28         #endregion
29
30         #region Constructors
31         /// <summary>
32         /// Default constructor - primarily created for supporting usage of this Documentation class by SOM.
33         /// </summary>
34         internal Documentation()
35         {
36         }        
37         #endregion
38        
39         #region Properties
40
41         /// <summary>
42         /// Returns the kind of the type
43         /// </summary>
44         public override BuiltInTypeKind BuiltInTypeKind { get { return BuiltInTypeKind.Documentation; } }
45
46         /// <summary>
47         /// Gets the Summary for this Documentation instance.
48         /// </summary>
49         /// 
50         public string Summary
51         {
52             get
53             {
54                 return _summary;
55             }
56             internal set
57             {
58                 if (value != null)
59                     _summary = value;
60                 else
61                     _summary = "";
62             }
63         }
64
65         /// <summary>
66         /// Gets the LongDescription for this Documentation instance.
67         /// </summary>
68         /// 
69         public string LongDescription
70         {
71             get
72             {
73                 return _longDescription;
74             }
75             internal set
76             {
77                 if (value != null)
78                     _longDescription = value;
79                 else
80                     _longDescription = "";
81             }
82         }
83
84
85         /// <summary>
86         /// This property is required to be implemented for inheriting from MetadataItem. As there can be atmost one
87         /// instance of a nested-Documentation, return the constant "Documentation" as it's identity.
88         /// </summary>
89         internal override string Identity
90         {
91             get
92             {
93                 return "Documentation";
94             }
95         }
96
97         /// <summary>
98         /// Returns true if this Documentation instance contains only null/empty summary and longDescription
99         /// </summary>
100         /// 
101         public bool IsEmpty
102         {
103             get
104             {
105                 if (string.IsNullOrEmpty(_summary) && string.IsNullOrEmpty(_longDescription) )
106                 {
107                     return true;
108                 }
109
110                 return false;
111             }
112         }
113
114
115         #endregion
116         
117         #region Methods
118
119         /// <summary>
120         /// </summary>
121         public override string ToString()
122         {
123             return _summary;
124         }
125
126         #endregion
127     }
128 }