title: "design pattern" for CRUD in ADO.NET Entity Framework 4.1
body: <p>I would like ask you if exist some "design pattern" for CRUD in ADO.NET Entity Framework 4.1.</p>
  
  <p>For example this method load object from DB.</p>
  
  <pre><code>private static Project GetObjects(int id)
  {
      var connSetting = ConfigurationManager.ConnectionStrings["ProjectEntities"];
      var conn = new EntityConnection(connSetting.ConnectionString);
      conn.Open();
  
      using(var contex= new ProjectEntities(conn))
      {
          var project = (from p in contex.Projects
                         where p.ProjectId == id
                         select p).FirstOrDefault();
  
          contex.Detach(project);
  
          return project;
      }
  }
  </code></pre>
  
  <p>this method do update:</p>
  
  <pre><code>private static void UpdateObject(Project obj)
  {
      var connSetting = ConfigurationManager.ConnectionStrings["ProjectEntities"];
      var conn = new EntityConnection(connSetting.ConnectionString);
      conn.Open();
  
      using (var contex = new ProjectEntities(conn))
      {
          var entity = (Project)contex.GetObjectByKey(obj.EntityKey);
          contex.ApplyCurrentValues(entity.EntityKey.EntitySetName, obj);
          contex.SaveChanges();
      }
  
  }
  </code></pre>
  
  <p>and this method delete object </p>
  
  <pre><code>private static void DeleteObject(Project obj)
  {
      var connSettings = ConfigurationManager.ConnectionStrings["ProjectEntities"];
      var conn = new EntityConnection(connSettings.ConnectionString);
      conn.Open();
      using(var ctx = new ProjectEntities())
      {
          var entity = (Project)ctx.GetObjectByKey(obj.EntityKey);
          ctx.DeleteObject(entity);
          ctx.SaveChanges();
      }
  }
  </code></pre>
  
  <p>I would like have a nice universal class for CRUD with ADO.NET EF in DB...can you help me? Get link with good sample?</p>