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.
Trek12_API/Sources/Tests/DbConsole/Program.cs

42 lines
789 B

using EntityFrameWorkLib;
using Microsoft.EntityFrameworkCore;
PlayerEntity p1 = new PlayerEntity
{
Pseudo = "Jax",
NbWin = 0,
NbPlayed = 0,
MaxZone = 0,
MaxPoints = 0,
NbPoints = 0
};
PlayerEntity p2 = new PlayerEntity
{
Pseudo = "Theo",
NbWin = 0,
NbPlayed = 0,
MaxZone = 0,
MaxPoints = 0,
NbPoints = 0
};
using (var context = new SQLiteContext())
{
Console.WriteLine("Create and Insert new Champion");
context.Add(p1);
context.Add(p2);
context.SaveChanges();
}
public class SQLiteContext : TrekContext
{
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
if (!options.IsConfigured)
{
options.UseSqlite($"Data Source=projet.Champions.db");
}
}
}