Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure if this is the best way, but I managed to do something by implementing <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.advanced.schemaimporterextension%28v=vs.80%29.aspx" rel="nofollow"><code>SchemaImporterExtension</code></a>:</p> <pre class="lang-cs prettyprint-override"><code>namespace SchemaImport { public class ADODBSchemaImporterExtension : SchemaImporterExtension { public override CodeExpression ImportDefaultValue(string value, string type) { return new CodeTypeReferenceExpression(type); } public override string ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace codeNamespace, CodeGenerationOptions options, CodeDomProvider codeGenerator) { return null; } public override string ImportSchemaType(string name, string ns, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider) { if (name.StartsWith("ADODB.")) { compileUnit.ReferencedAssemblies.Add("adodb.dll"); mainNamespace.Imports.Add(new CodeNamespaceImport("ADODB")); return name.Substring(name.IndexOf(".") + 1); } return null; } } } </code></pre> <p>together with defining the <code>ADODB.Recordset</code> as an <code>xsd:complexType</code>:</p> <pre class="lang-xml prettyprint-override"><code>&lt;xs:element name="Table"&gt; &lt;xs:complexType&gt; &lt;xs:all&gt; &lt;!-- ...snip... --&gt; &lt;xs:element name="CellValues" type="ADODB.RecordSet"/&gt; &lt;/xs:all&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:complexType name="ADODB.Recordset"/&gt; </code></pre> <p>I then had to add this class to <code>machine.config</code>:</p> <pre class="lang-xml prettyprint-override"><code>&lt;system.xml.serialization&gt; &lt;schemaImporterExtensions&gt; &lt;add type="SchemaImport.ADODBSchemaImporterExtension, SchemaImport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd583032ee337c41" /&gt; &lt;/schemaImporterExtensions&gt; &lt;/system.xml.serialization&gt; </code></pre> <p>and specify the assembly in a parameter file (the <code>/p:parameters.xml</code> switch) to xsd.exe:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsd xmlns='http://microsoft.com/dotnet/tools/xsd/'&gt; &lt;generateClasses language='c#' namespace='TableDocument'&gt; &lt;schemaImporterExtensions&gt; &lt;type&gt;SchemaImport.ADODBSchemaImporterExtension, SchemaImport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd583032ee337c41&lt;/type&gt; &lt;/schemaImporterExtensions&gt; &lt;/generateClasses&gt; &lt;/xsd&gt; </code></pre> <p>I ended up with a .cs file with the appropriate Table class, in the TableDocument namespace that had the ADODB as a reference and <code>using</code> statement.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload