I'm trying to use SourceGenerator to generate classes according to a specific package structure.  Our application consists of a number of base classes, and then vertical-market extensions living in their own packages.  For example, we have a package base.entity which contains base classes A and B.  We want to have a package financial.entity, which contains derived classes A1 extends A and B1 extends B, a second package retail.entity which contains derived classes A2 and B2, and so on.

 

I have set up XML schemas base.xsd, containing the definitions for A and B, and financial.xsd containing the definitions for A1 and B1.  financial.xsd looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

 

<xsd:include schemaLocation="base.xsd"/>

           

  <xsd:complexType name="A1">

                        <xsd:complexContent>

                                    <xsd:extension base="A">

                                                <xsd:sequence>

                                                            <xsd:element name="anewfield" type="xsd:string"/>

                                                </xsd:sequence>

                                    </xsd:extension>

                        </xsd:complexContent>

            </xsd:complexType>

 

  <xsd:complexType name="B1">

                        <xsd:complexContent>

                                    <xsd:extension base="B">

                                                <xsd:sequence>

                                                            <xsd:element name="anotherfield" type="xsd:string"/>

                                                </xsd:sequence>

                                    </xsd:extension>

                        </xsd:complexContent>

            </xsd:complexType>

 

</xsd:schema>

 

 

Here's my problem.  I want to generate classes from base.xsd into package base.entity (which I can do just fine), and I want to generate classes from financial.xsd into package financial.entity.  When I run sourcegenerator on financial.xsd, setting the package argument to financial.entity, it builds four classes, A, B, A1, and B1 in package financial.entity, and it also makes A1 extend financial.entity.A, instead of base.entity.A which is what I want.

 

So, my question: is there a way to specify a base class in another package?  Note that the superclass property in the properties file doesn't do what I want, since each class needs to extend a different base class.

 

Any help would be much appreciated!

 

 

Reply via email to