コード例 #1
0
 public void Insert(T entity)
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         context.Set <T>().Add(entity);
         context.SaveChanges();
     }
 }
コード例 #2
0
        public void Delete(T entity)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                context.Entry(entity).State = EntityState.Deleted;

                context.SaveChanges();
            }
        }