public RepositoryDocentiTest() { var options = new DbContextOptionsBuilder <ContestoFinsa>() .UseInMemoryDatabase("InMemory" + counter++) .Options; ctx = new ContestoFinsa(options); docentiRepository = new RepositoryDocenti(ctx); ctx.Docenti.AddRange(CreaDocenti(10)); ctx.SaveChanges(); }
public void Save() { try { ctx.SaveChanges(); } catch (DbUpdateConcurrencyException e) { throw new ConnectionException(e.Message); } catch (DbUpdateException e) { throw new DBEditException(e.Message); } }