title: Repository pattern with EF4 CTP5
body: <p>I'm trying to implement the repository pattern with ef4 ctp5, I came up with something but I'm no expert in ef so <strong>I want to know if what I did is good.</strong></p>
  
  <p>this is my db context</p>
  
  <pre><code>public class Db : DbContext
  {
      public DbSet&lt;User&gt; Users { get; set; }
      public DbSet&lt;Role&gt; Roles { get; set; }
  }
  </code></pre>
  
  <p>and the repository: (simplified)</p>
  
  <pre><code>public class Repo&lt;T&gt; : IRepo&lt;T&gt; where T : Entity, new()
  {
          private readonly DbContext context;
  
          public Repo()
          {
              context = new Db();
          }
  
          public IEnumerable&lt;T&gt; GetAll()
          {
              return context.Set&lt;T&gt;().AsEnumerable();
          }
  
          public long Insert(T o)
          {
              context.Set&lt;T&gt;().Add(o);
              context.SaveChanges();
              return o.Id;
          }
  }
  </code></pre>