public static void Initialize(IServiceProvider serviceProvider) { using (var context = new TodoListContext(serviceProvider. GetRequiredService <DbContextOptions <TodoListContext> >())) { if (context.TodoList.Any()) { return; } context.SaveChanges(); } }
public SqlTodoListData(TodoListContext db) { this.db = db; }