Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CompileIdentityConstraint()

void System.Xml.Schema.SchemaCollectionCompiler.CompileIdentityConstraint ( XmlSchemaIdentityConstraint xi)
inlineprivate

Definition at line 1963 of file SchemaCollectionCompiler.cs.

1964 {
1965 if (xi.IsProcessing)
1966 {
1967 xi.CompiledConstraint = CompiledIdentityConstraint.Empty;
1969 }
1970 else
1971 {
1972 if (xi.CompiledConstraint != null)
1973 {
1974 return;
1975 }
1976 xi.IsProcessing = true;
1977 CompiledIdentityConstraint compiledIdentityConstraint = null;
1978 try
1979 {
1980 SchemaNamespaceManager nsmgr = new SchemaNamespaceManager(xi);
1981 compiledIdentityConstraint = new CompiledIdentityConstraint(xi, nsmgr);
1982 if (xi is XmlSchemaKeyref)
1983 {
1984 XmlSchemaIdentityConstraint xmlSchemaIdentityConstraint = (XmlSchemaIdentityConstraint)_schema.IdentityConstraints[((XmlSchemaKeyref)xi).Refer];
1985 if (xmlSchemaIdentityConstraint == null)
1986 {
1987 throw new XmlSchemaException(System.SR.Sch_UndeclaredIdentityConstraint, ((XmlSchemaKeyref)xi).Refer.ToString(), xi);
1988 }
1990 if (xmlSchemaIdentityConstraint.CompiledConstraint == null)
1991 {
1992 throw new XmlSchemaException(System.SR.Sch_RefInvalidIdentityConstraint, ((XmlSchemaKeyref)xi).Refer.ToString(), xi);
1993 }
1994 if (xmlSchemaIdentityConstraint.Fields.Count != xi.Fields.Count)
1995 {
1996 throw new XmlSchemaException(System.SR.Sch_RefInvalidCardin, xi.QualifiedName.ToString(), xi);
1997 }
1998 if (xmlSchemaIdentityConstraint.CompiledConstraint.Role == CompiledIdentityConstraint.ConstraintRole.Keyref)
1999 {
2000 throw new XmlSchemaException(System.SR.Sch_ReftoKeyref, xi.QualifiedName.ToString(), xi);
2001 }
2002 }
2004 }
2005 catch (XmlSchemaException ex)
2006 {
2007 if (ex.SourceSchemaObject == null)
2008 {
2009 ex.SetSource(xi);
2010 }
2012 xi.CompiledConstraint = CompiledIdentityConstraint.Empty;
2013 }
2014 finally
2015 {
2016 xi.IsProcessing = false;
2017 }
2018 }
2019 }
static string Sch_IdentityConstraintCircularRef
Definition SR.cs:928
static string Sch_RefInvalidCardin
Definition SR.cs:724
static string Sch_RefInvalidIdentityConstraint
Definition SR.cs:722
static string Sch_UndeclaredIdentityConstraint
Definition SR.cs:720
static string Sch_ReftoKeyref
Definition SR.cs:726
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void CompileIdentityConstraint(XmlSchemaIdentityConstraint xi)
XmlSchemaObjectTable IdentityConstraints
Definition XmlSchema.cs:313

References System.Xml.Schema.SchemaCollectionCompiler._schema, System.Xml.Schema.SchemaCollectionCompiler.CompileIdentityConstraint(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.CompiledIdentityConstraint.Empty, System.Xml.Schema.XmlSchema.IdentityConstraints, System.SR.Sch_IdentityConstraintCircularRef, System.SR.Sch_RefInvalidCardin, System.SR.Sch_RefInvalidIdentityConstraint, System.SR.Sch_ReftoKeyref, System.SR.Sch_UndeclaredIdentityConstraint, and System.Xml.Schema.BaseProcessor.SendValidationEvent().

Referenced by System.Xml.Schema.SchemaCollectionCompiler.Compile(), System.Xml.Schema.SchemaCollectionCompiler.CompileElement(), and System.Xml.Schema.SchemaCollectionCompiler.CompileIdentityConstraint().