public void InitContext() { var builder = new DbContextOptionsBuilder <EDBContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) // don't raise the error warning us that the in memory db doesn't support transactions .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning)); var context = new EDBContext(builder.Options); var allAccounts = (from a in context.Account select a).ToList(); if (allAccounts.Count != 0) { context.RemoveRange(allAccounts); } context.SaveChanges(); context.Account.Add(account); context.SaveChanges(); var allNotes = (from n in context.Note select n).ToList(); if (allNotes.Count != 0) { context.RemoveRange(allNotes); } context.SaveChanges(); notes.ForEach(n => n.AccountId = account.AccountId); context.AddRange(notes); context.SaveChanges(); _edbContext = context; }
public TokenController(EDBContext dBContext) { DBContext = dBContext; }
public UnitOfWork() { context = new EDBContext(); }
public UnitOfWork(EDBContext context) { this.context = context; }
public AccountController(EDBContext dBContext) { DBContext = dBContext; }
public ValuesController(EDBContext dBContext) { DBContext = dBContext; }
public NoteController(EDBContext dBContext) { DBContext = dBContext; }