SQLServer XML datatype support

10 posts, 0 answers
  1. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 11 Feb 2009 Link to this post

    Hi,

    seems that this datatype isnt managed from OpenAccess... are there hope in a future release?

    Thanks.
  2. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 13 Feb 2009 Link to this post

    UP, please. I need this information about my future projects.


    Regards.
  3. DevCraft banner
  4. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 13 Feb 2009 Link to this post

    Hi Andrea,
    The only way at the moment is to map the xml column to a string and convert it in memory.

    I have made a small forward mapped example for you but it should work reverse the same way.

    Greetings,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 18 Feb 2009 Link to this post

    This didnt mean that I can use the XML datatype in SQLServer 2008. The forward wizard will create at most a VARCHAR(MAX) column.
    It's true?

    Regards.
  6. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 18 Feb 2009 Link to this post

    Hi Andrea,
    I have tested it and I am getting an XML column in the table. I did use SQL2008 express

    Greetings,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 19 Feb 2009 Link to this post

    How had you write this in the App.config through the Forward Wizard?

    <field name="xml"
        <extension key="db-column"
        <extension key="db-type" value="LONGVARCHAR" /> 
        <extension key="db-column-name" value="xml" /> 
        <extension key="db-sql-type" value="xml" /> 
        </extension> 
    </field> 

    I mean the tag with db-sql-type = xml


    Thanks



  8. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 19 Feb 2009 Link to this post

    Hi Andrea,
    No, the comboboxes does not contain these settings, I did it by hand.

    All the best,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 19 Feb 2009 Link to this post

    :D

    From your Telerik "OpenAccess ORM Programmer's Guide":

    It is not recommended to edit the metadata directly; you should use the Properties Dialog inside Visual Studio. The dialog appears by clicking on OpenAccess ORM | Mapping menu. It is also available as a menu entry, when you right click on a code element on your project's Class View.

    For more information about these settings and the integration of OpenAccess ORM with Visual Studio® .NET refer to Telerik OpenAccess ORM in Microsoft Visual Studio .NET.


    I hope that the wizards dont overwrite this hand-added code in App.config

    Cheers.


  10. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 19 Feb 2009 Link to this post

    Hello Andrea,
    We are rapidly working on the documentation, as we know that it is not in the appropriate state. We are polishing all the old content that is incorrect, and adding new as well. We hope that we will have new and shiny documentation for the Q1 2009 release.

    Kind regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  11. XXXX
    XXXX avatar
    57 posts
    Member since:
    Jun 2008

    Posted 25 May 2011 Link to this post

    Since this thread came up in my search and helped me I would like to share my additions.
    Following code blocks show how I extended the OA generated classes to handle XML data and XML Schema (stored as XML).

    using System.Xml; 
    namespace XML_Column_Example 
    {     public partial class TableWithXML
         { // private property _xml defined in the generated code
             public virtual XmlDocument xml { 
                    get {
                          XmlDocument doc = new XmlDocument();
                          if (!string.IsNullOrEmpty(this._xml)) 
                                doc.LoadXml(this._xml); 
                          return doc; } 
                    set {
                          this._xml = value.InnerXml;
     } } } 

    using System.Xml;
    using System.Xml.Schema;   
    namespace XML_Column_Example  
    {     public partial class TableWithXMLSchema 
         { // private property _xmlSchema defined in the generated code 
        public virtual XmlSchema Schema
            {
                get 
                {
                    XmlSchema xsd = new XmlSchema();
                    if (!string.IsNullOrEmpty(this._xmlSchema))
                    {
                        xsd = XmlSchema.Read(new StringReader(this._xmlSchema),null);
                    }
                    return xsd;
                }
                set
                {
                    StringWriter stringWriter = new StringWriter();
                    XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter );
                    xmlTextWriter.Formatting = Formatting.Indented;
                    value.Write(xmlTextWriter);
                    xmlTextWriter.Flush();
                    this._xmlSchema = stringWriter.ToString();
                }
            }
        }
    }

    Hope this can be of help to others.
    All comments are welcome.
    Yours
       B.


Back to Top
DevCraft banner