示例#1
0
 public virtual void Delete(TEntity entityToDelete)
 {
     if (context.Entry(entityToDelete).State == EntityState.Detached)
     {
         dbSet.Attach(entityToDelete);
     }
     dbSet.Remove(entityToDelete);
 }
示例#2
0
 public async Task SaveDocument(Document document)
 {
     using (var context = new DMSEntities())
     {
         context.Configuration.ProxyCreationEnabled = true;
         context.Entry(document).State = EntityState.Added;
         int x = await(context.SaveChangesAsync());
     }
 }