Ejemplo n.º 1
0
        public void AddTypeNonExtension()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Add("foo", typeof(int));
        }
Ejemplo n.º 2
0
        internal SchemaImporter(XmlSchemas schemas, CodeGenerationOptions options, CodeDomProvider codeProvider, ImportContext context)
        {
            if (!schemas.Contains(XmlSchema.Namespace))
            {
                schemas.AddReference(XmlSchemas.XsdSchema);
                schemas.SchemaSet.Add(XmlSchemas.XsdSchema);
            }
            if (!schemas.Contains(XmlReservedNs.NsXml))
            {
                schemas.AddReference(XmlSchemas.XmlSchema);
                schemas.SchemaSet.Add(XmlSchemas.XmlSchema);
            }
            this.schemas      = schemas;
            this.options      = options;
            this.codeProvider = codeProvider;
            this.context      = context;
            Schemas.SetCache(Context.Cache, Context.ShareTypes);

            SchemaImporterExtensionsSection section = PrivilegedConfigurationManager.GetSection(ConfigurationStrings.SchemaImporterExtensionsSectionPath) as SchemaImporterExtensionsSection;

            if (section != null)
            {
                extensions = section.SchemaImporterExtensionsInternal;
            }
            else
            {
                extensions = new SchemaImporterExtensionCollection();
            }
        }
Ejemplo n.º 3
0
        public void AddNameNull()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Add(null, typeof(MyExtension));
        }
Ejemplo n.º 4
0
        public void AddTypeNull()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Add("foo", null);
        }
Ejemplo n.º 5
0
        public void RemoveNonExistent()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Remove("foo");
        }
Ejemplo n.º 6
0
        public void AddTypeAbstract()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Add("foo", typeof(SchemaImporterExtension));
        }
Ejemplo n.º 7
0
        internal SchemaImporter(XmlSchemas schemas, CodeGenerationOptions options, CodeDomProvider codeProvider, System.Xml.Serialization.ImportContext context)
        {
            if (!schemas.Contains("http://www.w3.org/2001/XMLSchema"))
            {
                schemas.AddReference(XmlSchemas.XsdSchema);
                schemas.SchemaSet.Add(XmlSchemas.XsdSchema);
            }
            if (!schemas.Contains("http://www.w3.org/XML/1998/namespace"))
            {
                schemas.AddReference(XmlSchemas.XmlSchema);
                schemas.SchemaSet.Add(XmlSchemas.XmlSchema);
            }
            this.schemas      = schemas;
            this.options      = options;
            this.codeProvider = codeProvider;
            this.context      = context;
            this.Schemas.SetCache(this.Context.Cache, this.Context.ShareTypes);
            SchemaImporterExtensionsSection section = System.Configuration.PrivilegedConfigurationManager.GetSection(ConfigurationStrings.SchemaImporterExtensionsSectionPath) as SchemaImporterExtensionsSection;

            if (section != null)
            {
                this.extensions = section.SchemaImporterExtensionsInternal;
            }
            else
            {
                this.extensions = new SchemaImporterExtensionCollection();
            }
        }
Ejemplo n.º 8
0
        public void Add()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            Assert.AreEqual(0, c.Add("foo", typeof(MyExtension)), "#1");
            Assert.IsTrue(c [0] is MyExtension, "#2");
        }
Ejemplo n.º 9
0
        public void DuplicateNames()
        {
            SchemaImporterExtensionCollection c =
                new SchemaImporterExtensionCollection();

            c.Add("foo", typeof(MyExtension));
            c.Add("foo", typeof(MyExtension2));
        }
Ejemplo n.º 10
0
 public void AddTypeAbstract2()
 {
     try {
         SchemaImporterExtensionCollection c =
             new SchemaImporterExtensionCollection();
         c.Add("foo", typeof(MyAbstractExtension));
         Assert.Fail("Abstract type should not be accepted.");
     } catch (Exception) {
     }
 }
Ejemplo n.º 11
0
 internal SchemaImporter(XmlSchemas schemas, CodeGenerationOptions options, CodeDomProvider codeProvider, ImportContext context)
 {
     if (!schemas.Contains(XmlSchema.Namespace))
     {
         schemas.AddReference(XmlSchemas.XsdSchema);
         schemas.SchemaSet.Add(XmlSchemas.XsdSchema);
     }
     if (!schemas.Contains(XmlReservedNs.NsXml))
     {
         schemas.AddReference(XmlSchemas.XmlSchema);
         schemas.SchemaSet.Add(XmlSchemas.XmlSchema);
     }
     _schemas      = schemas;
     _options      = options;
     _codeProvider = codeProvider;
     _context      = context;
     Schemas.SetCache(Context.Cache, Context.ShareTypes);
     _extensions = new SchemaImporterExtensionCollection();
 }