DataMappingType in the DataSet Designer

  • Thread starter Alexander Walker
  • Start date
A

Alexander Walker

Hello


I'm trying to set the DataMappingType of columns on a typed dataset that I have
created using the DataSet designer in visual studio 2005, is there a way that I
can set the DataMappingType of the columns? I've tried editing the code that it
generates but any changes I make are overwritten if I open the design view, the
method that sets the DataMappingType is called InitClass and is private to each
DataTable

what can I do?

Alex
 
S

Steven Cheng[MSFT]

Hi Alex,

Thank you for posting.

As for the DataSet and its associated component classes, it is actually
generated according to the DataSet.xsd (xml schema) file. So IMO, if we
need to change the mapped datatype in our typedDataSet, we need to change
the type mapping info in the scheme file (xxxx.xsd). Based on my test, we
can change it through the below approachs:

1. Directly open the XSD file through xml editor or text editor,

<xs:element name="price" msprop:Generator_UserColumnName="price"
msprop:Generator_ColumnPropNameInRow="price"
msprop:Generator_ColumnVarNameInTable="columnprice"
msprop:Generator_ColumnPropNameInTable="priceColumn" type="xs:short" />

note the type="xs:short" is the type mapping.


2. Also, in VS IDE, in design-view, when select the typed DataSet's
certain column, in the property grid, you can find the "Data Type" property
which can be modifed also.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

Thank you for the response Alex,

So I got that what you want to do is change the typed DAtaSet's DataTable
Column's xml representation mapping (XmlElement or Attribute), correct? If
so, I'm afraid this is not quite simple to do. Actually, the DataSet's
generation process is on the contrary as what want to do here. The DataSet
class(designer generated code) is generated according to the xsd file(xml),
so this determines whether it use XMLElement or XmlAttributre for the table
column in XML represenation. However, for typed dataset, designer always
create the XML schema (xsd) and use XmlElement for table columns. (it use
attributes for untyped dataset), so there is not such setting on code or
DataSet after the xsd is created(which is at the very begining of hte
dataset generation).

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Alexander Walker

Hello Steven

Thanks for letting me know.

Might there be any improvements to the Dataset designer in the future that would
allow control over whether an XmlElement or an XmlAttribute is generated for a
column?

Is there any way that I could use the extensibility features of Visual Studio to
enable this functionality in the current version?

Alex
 
S

Steven Cheng[MSFT]

Thanks for your followup Alex,

So far I haven't found any existing add-in or utility for vs 2005 that
could do this setting. I think this will require a new custom tool
component be built for this functionality. Anyway, I suggest you submit
this request to the MSDN product feedback center so that our dev team can
also see such comments. Your feedback is really appreciated

http://lab.msdn.microsoft.com/productfeedback/default.aspx

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

That's fine. Thanks for your followup Alex,

And please always feel free to post here when there is anything we can help
you.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top