Consultor Eletrônico



Kbase P124570: Why does the output from WRITE-XMLSCHEMA cause extra tables to be generated in .NET?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/06/2007
Status: Unverified

GOAL:

Why does the output from WRITE-XMLSCHEMA cause extra tables to be generated in .NET?

FACT(s) (Environment):

OpenEdge 10.1x

FIX:

The WRITE-XMLSCHEMA method will write out an industry standard definition of a ProDataSet. If any of the temp-tables in the ProDataSet contain ABL EXTENT fields those fields will be written out with the minOccurs and maxOccurs attributes in the resulting xsd file. An example of the output for the sports2000 SalesRep table is shown below:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:prodata="urn:schemas-progress-com:xml-prodata:0001">
<xsd:element name="MyDataSet" prodata:proDataSet="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ttSalesRep" minOccurs="0" maxOccurs="unbounded" prodata:undo="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SalesRep" type="xsd:string" nillable="true" prodata:format="x(4)" prodata:label="Sales Rep" prodata:help="Please enter the Sales Rep."/>
<xsd:element name="RepName" type="xsd:string" nillable="true" prodata:format="x(30)" prodata:label="Rep Name" prodata:help="Please enter the Name of the Salesperson."/>
<xsd:element name="Region" type="xsd:string" nillable="true" prodata:help="Please enter the Sales Region covered by this salesman."/>
<xsd:element name="MonthQuota" type="xsd:int" nillable="true" minOccurs="12" maxOccurs="12" prodata:label="Month Quota" prodata:help="Please enter the Month Quota."/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:unique name="SalesRep" prodata:primaryIndex="true">
<xsd:selector xpath=".//ttSalesRep"/>
<xsd:field xpath="SalesRep"/>
</xsd:unique>
</xsd:element>
</xsd:schema>
In the example output from the WRITE-XMLSCHEMA method shown above the MonthQuota field is defined within the ABL as an extent field with 12 elements.

When this xsd file is used in .NET to generate a .NET DataSet definition the MonthQuota field will be turned into a separate table. This is normal behavior as the .NET DataSet class does not understand extent fields as they are defined and used in the ABL.

What this means is that if you attempt to pass your .NET DataSets and ABL ProDataSets back and forth to the AppServer as a string (LONGCHAR in the ABL) the DataSet definitions will not match and the attempt to load the string back into either the .NET DataSet or the ProDataSet will fail.

There are two possible resolutions to this problem.

The first is to remove the use of extent fields from the Progress Database.

The second option is to "flatten" out the extent fields when defining the temp-tables in the ProDataSet (i.e. MonthQuota[1], MonthQuota[2], etc would become separate fields MonthQuota1, MonthQuota2). This flattening of the extent fields is what ProxyGen will do automatically when it generates the code for any ProDataSet parameter which contains extent fields.