Before starting, thanks to everyone working on this project. Great job!
Here is the matter..
I want to use Strongly Typed Datasets in the Data Access Layer of a project.
As I don't want to write the whole of the layer by hand, I've decided to
develop a Data Access Layer Generator for PostgreSQL.
I've already finished the part that creates CRUD functions on the Database
layer. And now, I'm writing the part that creates the Data Access Layer
code in C#.
The generator use `xsd.exe` to generate the class code for schemas
genereted
by FillSchema method of PgDataAdapter. Everything seems working..
The DAL can than see and use the Strongly Typed DataSet by xsd.exe.
Except one problem..
When a method trys to fill the DataSet, it occurs a constraint violation
exception
even there is nothing violating a constraint.
Then I inspected the schema file and I saw a strange restriction in a
field::
<xs:element name="ID" msdata:ReadOnly="true" msdata:AutoIncrement="true"
type="xs:int" />
<xs:element name="Name" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="0" />
</xs:restriction>
</xs:simpleType>
</xs:element>
I could not understand why the Name element contains a simpleType node
containing a restriction.
Because there is no restriction about this column on the database. (
Well, it is a varchar(200) column )
Could this restriction be the reason of the constraint violation
exception ? Why and how is it generated ?
Thanks in advance.
Soner
|