title: Entity Framework - defining get without set accessors
body: <p>I created a new class library project in Visual Studio 2012, to define data classes in order to enable new database creation using Entity Framework code first. So I created 3 classes: </p>
  
  <p>Product as next:</p>
  
  <pre><code>namespace MyClassLibrary
  {
      public class Product
      {
          public virtual int ID { get; set; }
          public virtual string Name { get; set; }
      }
  }
  </code></pre>
  
  <p>Category as next:</p>
  
  <pre><code>using System.Collections.Generic;
  
  namespace MyClassLibrary
  {
      public class Department
      {
          public virtual int ID { get; set; }
          public virtual string Name { get; set; }
          public virtual ICollection&lt;Product&gt; Products { get; set; }
      }
  }
  </code></pre>
  
  <p>and ICategoryDataSource as next:</p>
  
  <pre><code>using System.Linq;
  
  namespace MyClassLibrary
  {
      public class ICategoryDataSource
      {
          IQueryable&lt;Product&gt; Products { get; }
          IQueryable&lt;Category&gt; Categories { get; }
      }
  }
  </code></pre>
  
  <p>In the last class, I get the next error message: 'MyClassLibrary.ICategoryDataSource.Products.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors. </p>
  
  <p>I do not need a setter here, please advise how can I avoid using set accessors.</p>