/// <summary> /// Rollback of entity changes and return full error message /// </summary> /// <param name="ex">Exception</param> /// <returns>Error</returns> protected string GetFullErrorTextAndRollbackEntityChanges(Exception ex) { var fullErrorText = GetFullErrorText(ex); var entities = _context.ChangeTracker.Entries(); foreach (var entry in entities) { if (entry == null) { continue; } //rollback of entity changes entry.State = EntityState.Unchanged; } _context.SaveChanges(); return(fullErrorText); }
public void Sil(Tablo tablo) { using var context = new CoreAppContext(); context.Set <Tablo>().Remove(tablo); context.SaveChanges(); }
public void Guncelle(Tablo tablo) { using var context = new CoreAppContext(); context.Set <Tablo>().Update(tablo); context.SaveChanges(); }
public void Ekle(Tablo tablo) { using var context = new CoreAppContext(); context.Set <Tablo>().Add(tablo); context.SaveChanges(); }
public virtual T Create(T entity) { _dbset.Add(entity); dbContext.SaveChanges(); return(entity); }
public User Create(User entity) { dbContext.Users.Add(entity); dbContext.SaveChanges(); return(entity); }