title: generic method in a non-generic class
body: <p>I'm trying to create a simple data access class which acts as a library to return various entities. All my entity classes are generated via the Linq-to-SQL mapper in VS 2013, and all of them can be returned from the dataContext via Find(primary id)</p>
  
  <p>I'd like to just define generic Find, Delete, Update etc without having to repeat it for every table/object but I don't want to create a Repository pattern.</p>
  
  <p>How do I create a generic method that works regardless? This is what I have and of course it says T not defined, but I thought we could create generic methods in non-generic classes, so what am I doing wrong?</p>
  
  <p>What I'd like to do is something like</p>
  
  <pre><code>var c = DAL&lt;Customer&gt;.Find(id)
  
  var e = DAL&lt;Employee&gt;.Find(id)
  </code></pre>
  
  <p>... etc. </p>
  
  <p>The code I attempted to write is </p>
  
  <pre><code>public class DAL
      {
          private string _key;
          private DataContext _context = null;
          //private DbSet&lt;T&gt; _table = null;
  
  
          public DAL(string key)
          {
              _key = key;
              _context = new DataContext();
          }
  
          public void Dispose()
          {
              _context.Dispose();
          }
  
  
          public DbSet&lt;T&gt; Find&lt;T&gt;(int id)
          {
              var d = _context.Set&lt;T&gt;();
              //return d.Find(id);
          }
      }
  </code></pre>
  
  <p>I'm kind of lost... I do not want to define </p>
  
  <pre><code>public class DAL&lt;T&gt; where T:class
  </code></pre>
  
  <p>which ties each DAL to a type</p>
  
  <p>This is the first time I'm venturing into generic nethods so any help appreciated</p>