Home All Groups Group Topic Archive Search About

DataMappingType in the DataSet Designer

Author
8 Apr 2006 1:39 AM
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

Author
10 Apr 2006 5:28 AM
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.)
Author
16 Apr 2006 10:07 PM
Alexander Walker
Hello Steven

Thank you for replying to my query

Unfortunately I did not word the question correctly

I do not want to change the DataType of a column

I wanted to change the MappingType
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatamappingtypeclasstopic.asp

The DataSet designer sets the MappingType as MappingType.Element, I want to set
the MappingType as MappingType.Attribute

How do I do this?

Alex
Author
17 Apr 2006 2:29 AM
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.
Author
7 May 2006 10:53 AM
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
Author
8 May 2006 2:31 AM
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.)
Author
8 May 2006 10:57 PM
Alexander Walker
I had a look at the suggestions on the MSDN Product Feedback Center and I found
this suggestion

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=313bd15f-6bb9-4417-8696-cca8d9156903

Its exactly the same issue that I'm having, I have voted for it and I think it
should be included in a future release of Visual Studio

Alex
Author
9 May 2006 10:30 AM
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.)