GameLibrary/Data/GameContext.cs

24 lines
647 B
C#
Raw Normal View History

2024-10-03 14:22:21 +05:00
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; }
}
}