20 lines
512 B
C#
20 lines
512 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace MyDarling.Models
|
|
{
|
|
public class DataContext : DbContext
|
|
{
|
|
protected readonly IConfiguration configuration;
|
|
public DataContext(IConfiguration configuration)
|
|
{
|
|
this.configuration = configuration;
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder opts)
|
|
{
|
|
opts.UseSqlite(configuration.GetConnectionString("MyDarlingDb"));
|
|
}
|
|
public DbSet<Product> Products => Set<Product>();
|
|
public DbSet<Figure> Figures => Set<Figure>();
|
|
}
|
|
} |