This is a migrated thread and some comments may be shown as answers.

SQLServer XML datatype support

9 Answers 138 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrea
Top achievements
Rank 2
Iron
Andrea asked on 11 Feb 2009, 12:46 PM
Hi,

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

Thanks.

9 Answers, 1 is accepted

Sort by
0
Andrea
Top achievements
Rank 2
Iron
answered on 13 Feb 2009, 01:48 PM
UP, please. I need this information about my future projects.


Regards.
0
Jan Blessenohl
Telerik team
answered on 13 Feb 2009, 03:30 PM
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.
0
Andrea
Top achievements
Rank 2
Iron
answered on 18 Feb 2009, 02:55 PM
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.
0
Jan Blessenohl
Telerik team
answered on 18 Feb 2009, 03:16 PM
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.
0
Andrea
Top achievements
Rank 2
Iron
answered on 19 Feb 2009, 10:27 AM
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



0
Jan Blessenohl
Telerik team
answered on 19 Feb 2009, 03:49 PM
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.
0
Andrea
Top achievements
Rank 2
Iron
answered on 19 Feb 2009, 05:16 PM
: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.


0
Dimitar Kapitanov
Telerik team
answered on 19 Feb 2009, 05:27 PM
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.
0
XXXX
Top achievements
Rank 1
answered on 25 May 2011, 12:47 PM
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.


Tags
Databases and Data Types
Asked by
Andrea
Top achievements
Rank 2
Iron
Answers by
Andrea
Top achievements
Rank 2
Iron
Jan Blessenohl
Telerik team
Dimitar Kapitanov
Telerik team
XXXX
Top achievements
Rank 1
Share this question
or