title: How to create a strongly typed MVC View based on a custom Linq2Sql class
body: <p>I have created a custom entity because I need to populate an entity with some data from a join in L2S.</p>
  
  <p>When I right click on the ActionResult code in the Controller to "Add View", and then choose "Create strongly typed view", my class doesn't show up in the classes available in the selector. I'm not sure why. Here is my code:</p>
  
  <pre><code>//The Model
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Data;
  using System.Data.SqlClient;
  
  namespace FurnitureStore.Models.Repository
  {
      public class FurnitureRepository
      {
          public IQueryable&lt;Listing&gt; GetProductListings()
          {
              FurnitureDataContext dc = new FurnitureDataContext();
  
          return (from p in dc.Products
                  join c in dc.Categories
                  on p.CategoryId equals c.CategoryId
                  select new Listing
                  {
                      ProductName = p.ProductName,
                      CategoryDescription = c.CategoryDescription
                  });
      }
  }
  }
  
  //The entity class
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  
  namespace FurnitureStore.Models
  {
      public class Listing
      {
          public string ProductName { get; set; }
          public string CategoryDescription { get; set; }
      }
  }
  
  //The Method in the Controller
  public ActionResult ProductListings()
  {
      FurnitureRepository fr = new FurnitureRepository();
      var listings = fr.GetProductListings();
      return View("ProductListings",listings);
  }
  </code></pre>