39 lines
1022 B
C#
39 lines
1022 B
C#
using Microsoft.Data.Sqlite;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FWLAZ_Web.Data
|
|
{
|
|
public class LocalDbContext : DbContext
|
|
{
|
|
protected readonly IConfiguration configuration;
|
|
|
|
public DbSet<Quiz> Quiz { get; set; }
|
|
public DbSet<QuestionGroup> QuestionGroup { get; set; }
|
|
public DbSet<Question> Question { get; set; }
|
|
public DbSet<Answer> Answers { get; set; }
|
|
|
|
public LocalDbContext(IConfiguration configuration)
|
|
{
|
|
this.configuration = configuration;
|
|
}
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlite(configuration.GetConnectionString("QuizDB"));
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|