コード例 #1
0
 public object Delete(E entity)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Set <E>().Attach(entity);
             result = contexto.Set <E>().Remove(entity);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public object Read()
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Configuration.LazyLoadingEnabled = false;
             listaResult = contexto.Set <E>().ToList <E>();
         }
         return(listaResult);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 //public object Create(E entity)
 public E Create(E entity)
 {
     try
     {
         using (var contexto = new DB_DACSEntities())
         {
             contexto.Configuration.LazyLoadingEnabled = false;
             result = contexto.Set <E>().Add(entity);
             contexto.SaveChanges();
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }