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

  • SEARCH
  • Home
  • 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 858167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:30:25+00:00 2026-05-15T08:30:25+00:00

var store = GetStore(); using (IsolatedStorageFileStream fileStream = store.OpenFile(RootData, FileMode.Create)) { DataContractSerializer serializer =

  • 0

var store = GetStore();
using (IsolatedStorageFileStream fileStream = store.OpenFile(RootData, FileMode.Create))
{
DataContractSerializer serializer = new DataContractSerializer(typeof(List));
serializer.WriteObject(fileStream, rootdatalist);
}

But this only serializes the rootdatalist, and not the subitems. The rootdatalist has a nodes List property, how do I serialize that, so that I get the list hierarchy serialized?

Since it’s dbml generated objects the Nodes property of Root is

public System.Data.Linq.Table<Node> Nodes
{
    get
    {
        return this.GetTable<Node>();
    }
}

My Datacontext return is:

public List<Root> GetRootList(Guid userid)
{
   DataLoadOptions loadopts = new DataLoadOptions();
   loadopts.LoadWith<Root>(s => s.Nodes);
   this.DataContext.LoadOptions = loadopts;
   return this.DataContext.Root.Where(s => s.Nodes.Count(n => n.UserId == userid) > 0).ToList();
}

the Node entityset looks as follows in my dbml designer

[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Root_Node", Storage="_Nodes", ThisKey="Id", OtherKey="RootId")]
[global::System.Runtime.Serialization.DataMemberAttribute(Order=5, EmitDefaultValue=false)]
public EntitySet<Node> Nodes
{
    get
    {
        if ((this.serializing && (this._Nodes.HasLoadedOrAssignedValues == false)))
        {
            return null;
        }
        return this._Nodes;
    }
    set
    {
        this._Nodes.Assign(value);
    }
}

Also I have to have the [Include]tag above my properties or nothing will be loaded.
Edit::
To others wanting to serialize dbml classes Link

  • 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-15T08:30:26+00:00Added an answer on May 15, 2026 at 8:30 am

    Can you include any more information about the contract types? I would expect, for example, that Root is marked as a data-contract, with the member as a data-member, for example:

    [DataContract]
    public class Root {
        [DataMember]
        public List<SubItem> Nodes {get;private set;}
    }
    
    [DataContract]
    public class SubItem {
        [DataMember]
        public int Foo {get;set;}
    
        [DataMember]
        public string Bar {get;set;}
    }
    

    That should then work. If not, it would really help to see your types (or a cut-down version of them, that illustrates the problem).

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer That should be fine. Libraries are just files on the… May 16, 2026 at 9:52 am
  • Editorial Team
    Editorial Team added an answer Your question is pretty vague and ambiguous. I don't see… May 16, 2026 at 9:52 am
  • Editorial Team
    Editorial Team added an answer It is kind of hard to try this out without… May 16, 2026 at 9:52 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

var store = new Ext.data.JsonStore({ id:'jfields', totalProperty:'totalcount', root:'rows', url: 'data.php', fields:[{ name:'jfields' }, {
I have a Store that contains a list of Products : var store =
When I store a jQuery object in a variable, like this: var $myObject =
I'm handling cookies using JavaScript to store some values in my asp.net web application.
function Player() { var score; this.getScore = function() { return score; } this.setScore =
When Ext JS issues a DELETE request from a restful store, it includes an
I have the following JS: http://monobin.com/__m1c171c4e and the following code: Code: var tpl =
How do you store the data received from jQuery getJSON to an array for
I am trying to have the function toggleClick return powerData. I need to store
this is my code snippet, where the program doesn't enter the foreach loop: var

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.