/
XmlSchemaIdEntityConstraint.cs
95 lines (80 loc) · 2.44 KB
/
XmlSchemaIdEntityConstraint.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.ComponentModel;
using System.Xml.Serialization;
namespace System.Xml.Schema
{
public class XmlSchemaIdentityConstraint : XmlSchemaAnnotated
{
private string? _name;
private XmlSchemaXPath? _selector;
private readonly XmlSchemaObjectCollection _fields = new XmlSchemaObjectCollection();
private XmlQualifiedName _qualifiedName = XmlQualifiedName.Empty;
private CompiledIdentityConstraint? _compiledConstraint;
[XmlAttribute("name")]
public string? Name
{
get { return _name; }
set { _name = value; }
}
[XmlElement("selector", typeof(XmlSchemaXPath))]
public XmlSchemaXPath? Selector
{
get { return _selector; }
set { _selector = value; }
}
[XmlElement("field", typeof(XmlSchemaXPath))]
public XmlSchemaObjectCollection Fields
{
get { return _fields; }
}
[XmlIgnore]
public XmlQualifiedName QualifiedName
{
get { return _qualifiedName; }
}
internal void SetQualifiedName(XmlQualifiedName value)
{
_qualifiedName = value;
}
[XmlIgnore]
internal CompiledIdentityConstraint? CompiledConstraint
{
get { return _compiledConstraint; }
set { _compiledConstraint = value; }
}
[XmlIgnore]
internal override string? NameAttribute
{
get { return Name; }
set { Name = value; }
}
}
public class XmlSchemaXPath : XmlSchemaAnnotated
{
private string? _xpath;
[XmlAttribute("xpath"), DefaultValue("")]
public string? XPath
{
get { return _xpath; }
set { _xpath = value; }
}
}
public class XmlSchemaUnique : XmlSchemaIdentityConstraint
{
}
public class XmlSchemaKey : XmlSchemaIdentityConstraint
{
}
public class XmlSchemaKeyref : XmlSchemaIdentityConstraint
{
private XmlQualifiedName _refer = XmlQualifiedName.Empty;
[XmlAttribute("refer")]
public XmlQualifiedName Refer
{
get { return _refer; }
set { _refer = value ?? XmlQualifiedName.Empty; }
}
}
}