DataMappingType in the DataSet Designer

Discussion in 'ASP .Net Web Controls' started by Alexander Walker, Apr 8, 2006.

  1. 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
    Alexander Walker, Apr 8, 2006
    #1
    1. Advertising

  2. 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.)
    Steven Cheng[MSFT], Apr 10, 2006
    #2
    1. Advertising

  3. Alexander Walker, Apr 16, 2006
    #3
  4. 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.
    Steven Cheng[MSFT], Apr 17, 2006
    #4
  5. 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
    Alexander Walker, May 7, 2006
    #5
  6. 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.)
    Steven Cheng[MSFT], May 8, 2006
    #6
  7. Alexander Walker, May 8, 2006
    #7
  8. 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.)
    Steven Cheng[MSFT], May 9, 2006
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GS
    Replies:
    1
    Views:
    2,661
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Jan 19, 2006
  2. John Dalberg
    Replies:
    0
    Views:
    450
    John Dalberg
    Mar 23, 2006
  3. Steve B.
    Replies:
    4
    Views:
    947
    Cheryl D Wise
    Jun 1, 2007
  4. Alexander Higgins
    Replies:
    3
    Views:
    1,064
    Teemu Keiski
    Jul 30, 2007
  5. Alexander Higgins
    Replies:
    0
    Views:
    437
    Alexander Higgins
    Jul 21, 2007
Loading...

Share This Page