1 //Copyright 2010 Microsoft Corporation
2 //
3 //Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4 //You may obtain a copy of the License at
5 //
6 //http://www.apache.org/licenses/LICENSE-2.0
7 //
8 //Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
9 //"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 //See the License for the specific language governing permissions and limitations under the License.
11 
12 
13 namespace System.Data.Services.Common
14 {
15     using System.Diagnostics;
16     using System.Collections.Generic;
17 
18     [DebuggerDisplay("EpmTargetPathSegment {SegmentName} HasContent={HasContent}")]
19     internal class EpmTargetPathSegment
20     {
21         #region Private fields.
22 
23         private String segmentName;
24 
25         private String segmentNamespaceUri;
26 
27         private String segmentNamespacePrefix;
28 
29         private List<EpmTargetPathSegment> subSegments;
30 
31         private EpmTargetPathSegment parentSegment;
32 
33         #endregion Private fields.
34 
EpmTargetPathSegment()35         internal EpmTargetPathSegment()
36         {
37             this.subSegments = new List<EpmTargetPathSegment>();
38         }
39 
EpmTargetPathSegment(String segmentName, String segmentNamespaceUri, String segmentNamespacePrefix, EpmTargetPathSegment parentSegment)40         internal EpmTargetPathSegment(String segmentName, String segmentNamespaceUri, String segmentNamespacePrefix, EpmTargetPathSegment parentSegment)
41             : this()
42         {
43             this.segmentName = segmentName;
44             this.segmentNamespaceUri = segmentNamespaceUri;
45             this.segmentNamespacePrefix = segmentNamespacePrefix;
46             this.parentSegment = parentSegment;
47         }
48 
49         internal String SegmentName
50         {
51             get
52             {
53                 return this.segmentName;
54             }
55         }
56 
57         internal String SegmentNamespaceUri
58         {
59             get
60             {
61                 return this.segmentNamespaceUri;
62             }
63         }
64 
65         internal String SegmentNamespacePrefix
66         {
67             get
68             {
69                 return this.segmentNamespacePrefix;
70             }
71         }
72 
73         internal EntityPropertyMappingInfo EpmInfo
74         {
75             get;
76             set;
77         }
78 
79         internal bool HasContent
80         {
81             get
82             {
83                 return this.EpmInfo != null;
84             }
85         }
86 
87         internal bool IsAttribute
88         {
89             get
90             {
91                 return this.SegmentName[0] == '@';
92             }
93         }
94 
95         internal EpmTargetPathSegment ParentSegment
96         {
97             get
98             {
99                 return this.parentSegment;
100             }
101         }
102 
103         internal List<EpmTargetPathSegment> SubSegments
104         {
105             get
106             {
107                 return this.subSegments;
108             }
109         }
110     }
111 }