title: EF Code First Custom Collections
body: <p>When creating code first collections can you implement a custom class that implements ICollection. The code below is conceptual not actual</p>
  
  <pre><code>public class Product
  {
      public int ProductId { get; set; }
      public string Name { get; set; }
      public Category Category { get; set; }
  }
  
  public class Category
  {
      public int CategoryId { get; set; }
      public string Name { get; set; }
      //Want to Avoid This
      public ICollection&lt;Product&gt; Products { get; set; }
      //Use his instead of above
      public ProductList ProductsInCategory {get;set;}
  }
  public class ProductsList :ICollection&lt;Product&gt;
  {
     public int DiscontinuedProductsCount
     {
          return internalList.Count();
     }
      //Icollection Methods Excluded
  }
  </code></pre>