Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3616014
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:26:48+00:00 2026-05-18T22:26:48+00:00

I have some data in my Linq.DataContext. I had succes in converting it to

  • 0

I have some data in my Linq.DataContext.

I had succes in converting it to an XSD – Schema, using the following code:

Dim changeset As System.Data.Linq.ChangeSet = c.GetChangeSet()
Dim objDic As New Dictionary(Of System.Type, List(Of Object))

If Not changeset Is Nothing AndAlso Not changeset.Inserts Is Nothing AndAlso Not changeset.Inserts.Count = 0 Then

For Each i As Object In changeset.Inserts

    Dim t As System.Type = i.GetType()

    If objDic.ContainsKey(t) Then
        objDic(t).Add(i)
    Else
        Dim l As New List(Of Object)
        l.Add(i)
        objDic(t) = l
    End If

Next

'XML schema 

For Each t As System.Type In objDic.Keys
    Dim s As New System.IO.FileStream(String.Format("{0}{1}", LinqBulkInsert.My.Application.Info.DirectoryPath, "\xmlschema.xsd"), System.IO.FileMode.Create)

    Using xmlw As New System.Xml.XmlTextWriter(s, System.Text.Encoding.UTF8)

        xmlw.WriteStartDocument()
        xmlw.WriteStartElement("xsd:schema")
        xmlw.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema")
        xmlw.WriteAttributeString("xmlns:sql", "urn:schemas-microsoft-com:mapping-schema")
        xmlw.WriteStartElement("xsd:element")
        xmlw.WriteAttributeString("name", t.Name)
        xmlw.WriteAttributeString("sql:relation", c.Mapping.GetTable(t).TableName)
        xmlw.WriteStartElement("xsd:complexType")
        xmlw.WriteStartElement("xsd:sequence")

        Dim pinfos As System.Reflection.PropertyInfo() = t.GetProperties

        For Each pi As System.Reflection.PropertyInfo In pinfos
            If Not pi.PropertyType.Equals(GetType(System.Guid)) Then
                xmlw.WriteStartElement("xsd:element")
                xmlw.WriteAttributeString("name", pi.Name)
                xmlw.WriteAttributeString("type", "xsd:" & XsdTypeConverter.getInstance.GetSimpleType(pi.PropertyType))
                xmlw.WriteEndElement()
            End If
        Next
        xmlw.WriteEndDocument()
        xmlw.Flush()

    End Using

    s.Close()
    'Schema wordt succesvol weggeschreven in xmlschema.xsd

Next

Now my question is, how can i extract the data to a complete readabke XML file (with all data in it).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:26:49+00:00Added an answer on May 18, 2026 at 10:26 pm

    Try to use DataContract and DataMember attributes in your context. Read these articles:

    http://msdn.microsoft.com/en-us/library/bb546185.aspx
    http://msdn.microsoft.com/en-us/library/bb546184.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some C#/Linq code used to merge data from excel file into db,
I have some code which needs to ensure some data is in a mysql
I'm considering the following: I have some data stream which I'd like to protect
I'm quite new to Linq and have had some problems updating my dabase. I
Hi I have a method to reset data objects by calling DataContext.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, Entity); .
I am using LINQ to XML to take some data from resources , and
Say that have the following CTE that returns the level of some tree data
I'm getting some data from my database and using linq to calculate sums and
I have some data with messed-up accented characters. For example in the data we
I have some data grouped in a table by a certain criteria, and for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.