title: Saving and Retrieving Entities of different types using LINQtoSQL
body: <p>Disclaimer:  Bit of a C# newbie - first Software Dev gig in awhile after being in QA for a couple years.</p>
  
  <p>I realize flavors of this question have been asked before (inheritance in LINQtoSQL and the like), but I'm hoping I ask the question differently.</p>
  
  <p>In my database, I will have a super-type of "Event" and multiple sub-types:  Conference, Meeting and Appointment, for example.</p>
  
  <pre><code>Event
    Id (PK)
    TypeId (FK EventTypes.Id)
    Title
  
  Conference
    Id (PK, FK Event.Id)
    Cost
    Topic
  
  Meeting
    Id (PK, FK Event.Id)
    Location
    Organizer
  
  Appointment
    Id (PK, FK Event.Id)
    Time
    Address
  </code></pre>
  
  <p>I am using Rob Conery's MVC StoreFront application as a reference.  He essentially gets data from the database and creates class objects, manually mapping Event.Id to db.Event.Id, etc.</p>
  
  <p>I'd like to do this with my Events data model - I'd like to retrieve all Events, and have a LINQ expression dynamic enough to create various event types based on some criteria (TypeId, for example).  </p>
  
  <pre><code>var result = from e in db.Events
               select new IEvent 
               {
                  // Little help? ;)
                };
  </code></pre>
  
  <p>It would be great to find a way to make it so each Event Type knows how to save itself and retrieve itself - I fear having to write the same code for each type, only varying the fields.  Make sense?</p>
  
  <p>I did see a question posed and someone answered with something like:</p>
  
  <pre><code>public bool Save&lt;T&gt;() {}
  </code></pre>
  
  <p>The problem is, I'm not sure where to put this code.  I'm also not sure if I should use an IEvent interface or an Event partial class.  </p>
  
  <p>I will now end this monster question with an advanced Thank You to those that can offer help/suggestions.</p>
  
  <p>--
  EDIT:  Good progress - going from DB to Views all with IEvent :) (<a href="https://stackoverflow.com/questions/955811/asp-net-mvc-rendering-a-list-containing-different-types-with-a-different-view">This Question Helped A Lot</a>)</p>
  
  <pre><code>public class SqlEventRepository : IEventRepository
  
    public IQueryable&lt;IEvent&gt; getEvents() {
       // Get Events without doing a query for each type..possible?
       var eventType1 = {query};
       var eventType2 = {query};
  
       return {concat of all queries};
    }
  
    public bool SaveEvent(IEvent) {
      // Can I avoid calling a save function for each type of event?
  </code></pre>
  
  <h2>      }</h2>