title: DataContext.Entity vs DataContext.GetTable<Entity>
body: <p>I'm implementing the repository "pattern" in my ASP.NET MVC application. So i was doing some reading to decide whether i should expose the entire DataContext (initializing it in the constructor) or just the table via .GetTable&lt;T&gt; when performance is the most important factor.</p>
  
  <p>While doing my googling i ran into the following code at <a href="http://www.codeguru.com/csharp/csharp/net30/article.php/c13799" rel="nofollow noreferrer">http://www.codeguru.com/csharp/csharp/net30/article.php/c13799</a>. In this code he takes out the table first and then queries on that object. So now im wondering if there is any advantage to this method.</p>
  
  <pre><code>public void PrintWinners()
  {
     // creates a data context that takes the path of the database
     DataContext dc = new DataContext(@"C:\Program Files\
        Microsoft SQL Server\MSSQL.1\MSSQL\Data\UCL.mdf");
  
     // retrieves a Table of Winner
     Table&lt;Winner&gt; winners = dc.GetTable&lt;Winner&gt;();
  
     // creates a sequence of winners ordered descending by the
     // winning year
     var result = from w in winners
                  orderby w.Year descending
                  select w;
  
     // prints the sequence of winners
     foreach (var w in result)
     {
        Console.WriteLine("{0} {1}, {2}",
        w.Year, w.Name, w.Country);
     }
  }
  </code></pre>