title: linq one to many relationship stores only one member of list
body: <p>I'm trying to set up a one to many relationship with linq on Windows Phone 8.
  My problem is that in the EntitySet&lt;> field only one of the classes which should be stored, really gets stored to the database. 
  So i made a simple Project to give you clue of my problem.
  There are two classes Person and Number. One Person can have many numbers.</p>
  
  <p>Here is the number class:</p>
  
  <pre><code>[Table]
  class Number
  {
      [Column(IsPrimaryKey = true, IsDbGenerated = true)]
      public int NumberID { get; set; }
  
      [Column]
      public int PhoneNumber { get; set; }
  
  }
  </code></pre>
  
  <p>And the Person class:</p>
  
  <pre><code>[Table]
  class Person
  {
      private EntitySet&lt;Number&gt; numbers = new EntitySet&lt;Number&gt;();
  
      [Column(IsPrimaryKey = true, IsDbGenerated = true)]
      public int PersonID { get; set; }
  
      [Column]
      public string Name { get; set; }
  
      [Association(Storage = "numbers", ThisKey = "PersonID", OtherKey = "NumberID")]
      public EntitySet&lt;Number&gt; Numbers
      {
          get { return numbers; }
          set
          {
              numbers.Assign(value);
          }
      }
  }
  </code></pre>
  
  <p>When i now try to insert a person with three numbers:</p>
  
  <pre><code>        EntitySet&lt;Number&gt; numbers = new EntitySet&lt;Number&gt;();
          DataBase db = new DataBase(App.DBConnectionString);
          Number num1 = new Number() { PhoneNumber = 111111 };
          Number num2 = new Number() { PhoneNumber = 222222 };
          Number num3 = new Number() { PhoneNumber = 333333 };
          Person person = new Person() { Name = "Donald" };
          numbers.Add(num1);
          numbers.Add(num2);
          numbers.Add(num3);
          person.Numbers = numbers;
  
  
          try
          {
              db.Persons.InsertOnSubmit(person);
              db.SubmitChanges();
          }
          catch (Exception s)
          {
              // do nothing
          }
  </code></pre>
  
  <p>And then try to retrieve the data again:</p>
  
  <pre><code>        DataBase db = new DataBase(App.DBConnectionString);
          string text = "";
          foreach (Person person in db.Persons)
          {
              foreach (Number num in person.Numbers)
              {
                  text += num.PhoneNumber + System.Environment.NewLine;
              }
          }
  
          TextBlock.Text = text;
  </code></pre>
  
  <p>i only get the first phone number which is '111111'. Interesting is, that on the second run the text string holds '111111' and '222222'. This is because in the second Person the second phone number is saved and in the third person the third phone number and so on.
  So if you do that often enough you get:
  111111
  222222
  333333
  111111
  222222
  333333
  ...
  Btw if you jump with the debugger to 'db.Persons.InsertOnSubmit(person);' and look into 'person' there is a list with all three numbers in it. So it should work...</p>
  
  <p>I tried really hard, but i can't figure out a way to get it right. My suspicion though is on the [Association] attribute. </p>
  
  <p>Here is a link to the source so you can get the whole picture if you want: <a href="https://docs.google.com/file/d/0B5G4zya_BlZyUlU0azVvbVdiajA/edit?usp=sharing" rel="nofollow">https://docs.google.com/file/d/0B5G4zya_BlZyUlU0azVvbVdiajA/edit?usp=sharing</a></p>