You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
910 B
38 lines
910 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace EFLol
|
|
{
|
|
public class MyDbContext : DbContext
|
|
{
|
|
public DbSet<ChampionEntity> Champions { get; set; }
|
|
public DbSet<SkinEntity> Skins { get; set; }
|
|
|
|
public MyDbContext()
|
|
{ }
|
|
|
|
public MyDbContext(DbContextOptions<MyDbContext> options)
|
|
: base(options)
|
|
{ }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
optionsBuilder.UseSqlite("Data Source=loldb.db");
|
|
}
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
modelBuilder.Entity<ChampionEntity>().Property(c => c.Id).ValueGeneratedOnAdd();
|
|
modelBuilder.Entity<SkinEntity>().Property(s => s.Id).ValueGeneratedOnAdd();
|
|
}
|
|
}
|
|
}
|