private void AddLabel(IKeepNoteContext context) { context.Labels.Add(new Label { NoteId = 1, Content = "EF Core" }); context.Labels.Add(new Label { NoteId = 1, Content = "ADO.NET" }); context.SaveChanges(); }
private void AddChecklist(IKeepNoteContext context) { context.Checklists.Add(new Checklist { NoteId = 1, Content = "EF Core Db First" }); context.Checklists.Add(new Checklist { NoteId = 1, Content = "Using Fluent API" }); context.SaveChanges(); }
private void AddNotes(IKeepNoteContext context) { context.Notes.Add(new Note { Title = "Sample" }); context.Notes.Add(new Note { Title = "Sample Note2" }); context.SaveChanges(); }
public DatabaseFixture() { var options = new DbContextOptionsBuilder <KeepNoteContext>() .UseInMemoryDatabase(databaseName: "NoteDB") .Options; //Initializing DbContext with InMemory context = new KeepNoteContext(options); // Insert seed data into the database using one instance of the context this.AddNotes(context); this.AddChecklist(context); this.AddLabel(context); }
/// <summary> /// Constructor /// </summary> /// <param name="context">KeepNoteContext </param> public NoteRepository(IKeepNoteContext context) { keepNoteDbConext = context; }
public NoteRepository(IKeepNoteContext dbContext) { context = dbContext; }
public void Dispose() { context = null; }
public NoteRepository(IKeepNoteContext keepNoteContext) { this.keepNoteContext = keepNoteContext; }