The entity framework context with a Task DbSet
Inheritance: DbContext
Exemplo n.º 1
0
        public static TasksContext Create(string connectionString)
        {
            var optionsBuilder = new DbContextOptionsBuilder<TasksContext>();
            optionsBuilder.UseSqlite(connectionString);

            // Ensure that the SQLite database and schema is created!
            var context = new TasksContext(optionsBuilder.Options);
            context.Database.EnsureCreated();

            return context;
        }
Exemplo n.º 2
0
        public static TasksContext Create(string connectionString)
        {
            var optionsBuilder = new DbContextOptionsBuilder <TasksContext>();

            optionsBuilder.UseSqlite(connectionString);

            // Ensure that the SQLite database and schema is created!
            var context = new TasksContext(optionsBuilder.Options);

            context.Database.EnsureCreated();

            return(context);
        }