title: Entity Framework options to map list of strings or list of int (List<string>)
body: <p>I want to store an object that contains a List of primitives using EF.</p>
  
  <pre><code>public class MyObject {
      public int Id {get;set;}
      public virtual IList&lt;int&gt; Numbers {get;set;}
  }
  </code></pre>
  
  <p>I know that <strong>EF cannot store</strong> this, but I'd like to know possible solutions to solve this problem.</p>
  
  <p>The 2 Solutions I can think of are:</p>
  
  <p>1.<strong>Create a Dummy object</strong> that has an Id and the Integervalue, e.g.</p>
  
  <pre><code>public class MyObject {
      public int Id {get;set;}
      public virtual IList&lt;MyInt&gt; Numbers {get;set;}
  }
  
  public class MyInt {
      public int Id {get;set;}
      public int Number {get;set;}
  }
  </code></pre>
  
  <p>2.<strong>Store the list values as a blob</strong>, e.g.</p>
  
  <pre><code>public class MyObject {
      public int Id {get;set;}
  
      /// use NumbersValue to persist/load the list values
      public string NumbersValue {get;set;}
  
      [NotMapped]
      public virtual IList&lt;int&gt; Numbers {
           get {
                return NumbersValue.split(',');
           }
           set {
               NumbersValue = value.ToArray().Join(",");
           }
      }
  }
  </code></pre>
  
  <p>The Problem with the 2. approach is, that I have to create a Custom IList implementation to keep track if someone modifies the returned collection.</p>
  
  <p><strong>Is there a better solution for this</strong>?</p>