Groups | Blog | Home
all groups > dotnet ado.net > august 2004 >

dotnet ado.net : Compile error in autogenerated dataset module (.xsd)


David Browne
8/31/2004 9:56:06 AM

[quoted text, click to view]

In the XSD, change the codegen:typedName of the column Site to something
else by adding a codegen attribute to the xs:element tag for the Site
column, eg

<xs:element name="Site" codegen:typedName="SiteID" codegen:nullValue=""
type="xs:string" minOccurs="0" />


See, in general,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingannotationswithtypeddataset.asp

For how to control all sorts of usefull things about the dataset class
through the XSD.

David

Gilbert Tordeur
8/31/2004 2:28:34 PM
Environment : Visual Studio 2003 v 7.1.3088 (French)
Development of a Windows application with SQL Server 2000

I get the following compile error message in the .xsd module : C:\Documents
and Settings\TORDEUR.FRYORKF\Mes documents\Visual Studio
Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly Property Site()
As SiteDataTable' et 'Public Overrides Property Site() As
System.ComponentModel.ISite' ne peuvent pas se surcharger mutuellement, car
seul 'ReadOnly' ou 'WriteOnly' les différencie. 'Shadows' est pris en compte
par défaut.

Translation : C:\Documents and Settings\TORDEUR.FRYORKF\Mes documents\Visual
Studio Projects\Annuaire\ClasseDsGeneral.vb(117): 'Public ReadOnly Property
Site() As SiteDataTable' and 'Public Overrides Property Site() As
System.ComponentModel.ISite' cannot override each other, because only the
return types are different. 'Shadows' is taken into account by default.

What does that mean ? What can I do ? I have not this problem with other
tables, only when I call this one. I have deleted everything and set it
again : the error comes again. Thank you for your help.

..xsd source follows :

'---------------------------------------------------------------------------
---

' <autogenerated>

' This code was generated by a tool.

' Runtime Version: 1.1.4322.573

'

' Changes to this file may cause incorrect behavior and will be lost if

' the code is regenerated.

' </autogenerated>

'---------------------------------------------------------------------------
---

Option Strict Off

Option Explicit On

Imports System

Imports System.Data

Imports System.Runtime.Serialization

Imports System.Xml



<Serializable(), _

System.ComponentModel.DesignerCategoryAttribute("code"), _

System.Diagnostics.DebuggerStepThrough(), _

System.ComponentModel.ToolboxItem(true)> _

Public Class ClasseDsGeneral

Inherits DataSet


Private tableSociete As SocieteDataTable


Private tableAnnuaire As AnnuaireDataTable


Private tablePays As PaysDataTable


Private tableSection As SectionDataTable


Private tableSite As SiteDataTable


Public Sub New()

MyBase.New

Me.InitClass

Dim schemaChangedHandler As
System.ComponentModel.CollectionChangeEventHandler = AddressOf
Me.SchemaChanged

AddHandler Me.Tables.CollectionChanged, schemaChangedHandler

AddHandler Me.Relations.CollectionChanged, schemaChangedHandler

End Sub


Protected Sub New(ByVal info As SerializationInfo, ByVal context As
StreamingContext)

MyBase.New

Dim strSchema As String = CType(info.GetValue("XmlSchema",
GetType(System.String)),String)

If (Not (strSchema) Is Nothing) Then

Dim ds As DataSet = New DataSet

ds.ReadXmlSchema(New XmlTextReader(New System.IO.StringReader(strSchema)))

If (Not (ds.Tables("Societe")) Is Nothing) Then

Me.Tables.Add(New SocieteDataTable(ds.Tables("Societe")))

End If

If (Not (ds.Tables("Annuaire")) Is Nothing) Then

Me.Tables.Add(New AnnuaireDataTable(ds.Tables("Annuaire")))

End If

If (Not (ds.Tables("Pays")) Is Nothing) Then

Me.Tables.Add(New PaysDataTable(ds.Tables("Pays")))

End If

If (Not (ds.Tables("Section")) Is Nothing) Then

Me.Tables.Add(New SectionDataTable(ds.Tables("Section")))

End If

If (Not (ds.Tables("Site")) Is Nothing) Then

Me.Tables.Add(New SiteDataTable(ds.Tables("Site")))

End If

Me.DataSetName = ds.DataSetName

Me.Prefix = ds.Prefix

Me.Namespace = ds.Namespace

Me.Locale = ds.Locale

Me.CaseSensitive = ds.CaseSensitive

Me.EnforceConstraints = ds.EnforceConstraints

Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)

Me.InitVars

Else

Me.InitClass

End If

Me.GetSerializationData(info, context)

Dim schemaChangedHandler As
System.ComponentModel.CollectionChangeEventHandler = AddressOf
Me.SchemaChanged

AddHandler Me.Tables.CollectionChanged, schemaChangedHandler

AddHandler Me.Relations.CollectionChanged, schemaChangedHandler

End Sub


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.&#0;esignerSerializationVisibility.Content)> _

Public ReadOnly Property Societe As SocieteDataTable

Get

Return Me.tableSociete

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.&#0;esignerSerializationVisibility.Content)> _

Public ReadOnly Property Annuaire As AnnuaireDataTable

Get

Return Me.tableAnnuaire

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.&#0;esignerSerializationVisibility.Content)> _

Public ReadOnly Property Pays As PaysDataTable

Get

Return Me.tablePays

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.&#0;esignerSerializationVisibility.Content)> _

Public ReadOnly Property Section As SectionDataTable

Get

Return Me.tableSection

End Get

End Property


<System.ComponentModel.Browsable(false), _

System.ComponentModel.DesignerSerializationVisibilityAttribute(System.Compon
entModel.&#0;esignerSerializationVisibility.Content)> _

Public ReadOnly Property Site As SiteDataTable

Get

Return Me.tableSite

End Get

End Property


Public Overrides Function Clone() As DataSet

Dim cln As ClasseDsGeneral = CType(MyBase.Clone,ClasseDsGeneral)

cln.InitVars

Return cln

End Function


Protected Overrides Function ShouldSerializeTables() As Boolean

Return false

End Function


Protected Overrides Function ShouldSerializeRelations() As Boolean

Return false

End Function


Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader)

Me.Reset

Dim ds As DataSet = New DataSet

ds.ReadXml(reader)

If (Not (ds.Tables("Societe")) Is Nothing) Then

Me.Tables.Add(New SocieteDataTable(ds.Tables("Societe")))

End If

If (Not (ds.Tables("Annuaire")) Is Nothing) Then

Me.Tables.Add(New AnnuaireDataTable(ds.Tables("Annuaire")))

End If

If (Not (ds.Tables("Pays")) Is Nothing) Then

Me.Tables.Add(New PaysDataTable(ds.Tables("Pays")))

End If

If (Not (ds.Tables("Section")) Is Nothing) Then

Me.Tables.Add(New SectionDataTable(ds.Tables("Section")))

End If

If (Not (ds.Tables("Site")) Is Nothing) Then

Me.Tables.Add(New SiteDataTable(ds.Tables("Site")))

End If

Me.DataSetName = ds.DataSetName

Me.Prefix = ds.Prefix

Me.Namespace = ds.Namespace

Me.Locale = ds.Locale

Me.CaseSensitive = ds.CaseSensitive

Me.EnforceConstraints = ds.EnforceConstraints

Me.Merge(ds, false, System.Data.MissingSchemaAction.Add)

Me.InitVars

End Sub


Protected Overrides Function GetSchemaSerializable() As
System.Xml.Schema.XmlSchema
AddThis Social Bookmark Button