private void CopyFacetsFromBaseType() {
RestrictionFacets baseRestriction = datatype.Restriction;
// Copy additional facets from the base type
if (
(derivedRestriction.Flags & RestrictionFlags.Length) == 0 &&
(baseFlags & RestrictionFlags.Length) != 0
) {
derivedRestriction.Length = baseRestriction.Length;
SetFlag(RestrictionFlags.Length);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinLength) == 0 &&
(baseFlags & RestrictionFlags.MinLength) != 0
) {
derivedRestriction.MinLength = baseRestriction.MinLength;
SetFlag(RestrictionFlags.MinLength);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MaxLength) == 0 &&
(baseFlags & RestrictionFlags.MaxLength) != 0
) {
derivedRestriction.MaxLength = baseRestriction.MaxLength;
SetFlag(RestrictionFlags.MaxLength);
}
if ((baseFlags & RestrictionFlags.Pattern) != 0) {
if (derivedRestriction.Patterns == null) {
derivedRestriction.Patterns = baseRestriction.Patterns;
}
else {
derivedRestriction.Patterns.AddRange(baseRestriction.Patterns);
}
SetFlag(RestrictionFlags.Pattern);
}
if ((baseFlags & RestrictionFlags.Enumeration) != 0) {
if (derivedRestriction.Enumeration == null) {
derivedRestriction.Enumeration = baseRestriction.Enumeration;
}
SetFlag(RestrictionFlags.Enumeration);
}
if (
(derivedRestriction.Flags & RestrictionFlags.WhiteSpace) == 0 &&
(baseFlags & RestrictionFlags.WhiteSpace) != 0
) {
derivedRestriction.WhiteSpace = baseRestriction.WhiteSpace;
SetFlag(RestrictionFlags.WhiteSpace);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MaxInclusive) == 0 &&
(baseFlags & RestrictionFlags.MaxInclusive) != 0
) {
derivedRestriction.MaxInclusive = baseRestriction.MaxInclusive;
SetFlag(RestrictionFlags.MaxInclusive);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MaxExclusive) == 0 &&
(baseFlags & RestrictionFlags.MaxExclusive) != 0
) {
derivedRestriction.MaxExclusive = baseRestriction.MaxExclusive;
SetFlag(RestrictionFlags.MaxExclusive);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinInclusive) == 0 &&
(baseFlags & RestrictionFlags.MinInclusive) != 0
) {
derivedRestriction.MinInclusive = baseRestriction.MinInclusive;
SetFlag(RestrictionFlags.MinInclusive);
}
if (
(derivedRestriction.Flags & RestrictionFlags.MinExclusive) == 0 &&
(baseFlags & RestrictionFlags.MinExclusive) != 0
) {
derivedRestriction.MinExclusive = baseRestriction.MinExclusive;
SetFlag(RestrictionFlags.MinExclusive);
}
if (
(derivedRestriction.Flags & RestrictionFlags.TotalDigits) == 0 &&
(baseFlags & RestrictionFlags.TotalDigits) != 0
) {
derivedRestriction.TotalDigits = baseRestriction.TotalDigits;
SetFlag(RestrictionFlags.TotalDigits);
}
if (
(derivedRestriction.Flags & RestrictionFlags.FractionDigits) == 0 &&
(baseFlags & RestrictionFlags.FractionDigits) != 0
) {
derivedRestriction.FractionDigits = baseRestriction.FractionDigits;
SetFlag(RestrictionFlags.FractionDigits);
}
}