public static XmlSchemaComplexType GetDataSetSchema(XmlSchemaSet schemaSet)
{
// For performance resons we are exploiting the fact that config files content is constant
// for a given appdomain so we can safely cache the prepared schema complex type and reuse it
if (s_schemaTypeForWSDL == null)
{
// to change the config file, appdomain needs to restart; so it seems safe to cache the schema
XmlSchemaComplexType tempWSDL = new XmlSchemaComplexType();
XmlSchemaSequence sequence = new XmlSchemaSequence();
XmlSchemaAny any = new XmlSchemaAny();
any.Namespace = XmlSchema.Namespace;
any.MinOccurs = 0;
any.ProcessContents = XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any);
any = new XmlSchemaAny();
any.Namespace = Keywords.DFFNS;
any.MinOccurs = 0; // when recognizing WSDL - MinOccurs="0" denotes DataSet, a MinOccurs="1" for DataTable
any.ProcessContents = XmlSchemaContentProcessing.Lax;
sequence.Items.Add(any);
sequence.MaxOccurs = decimal.MaxValue;
tempWSDL.Particle = sequence;
s_schemaTypeForWSDL = tempWSDL;
}
return s_schemaTypeForWSDL;
}