24 lines
647 B
C#
24 lines
647 B
C#
|
using Microsoft.Extensions.Configuration;
|
|||
|
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using GameLibrary.Models;
|
|||
|
|
|||
|
namespace GameLibrary.Data
|
|||
|
{
|
|||
|
public class GameContext : DbContext
|
|||
|
{
|
|||
|
protected readonly IConfiguration Configuration;
|
|||
|
public GameContext(IConfiguration configuration)
|
|||
|
{
|
|||
|
Configuration = configuration;
|
|||
|
}
|
|||
|
|
|||
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|||
|
{
|
|||
|
// connect to sqlite database
|
|||
|
options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"));
|
|||
|
}
|
|||
|
|
|||
|
public DbSet<Game> Games { get; set; }
|
|||
|
}
|
|||
|
}
|