Inserting mock data

pull/1/head
Arthur VALIN 2 years ago
parent c58e1dd91b
commit 8c404922e9

@ -5,6 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartWorkingDirectory>$(MSBuildProjectDirectory)</StartWorkingDirectory>
</PropertyGroup>
<ItemGroup>
@ -22,4 +23,8 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -1,2 +1,17 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
using EntityFramework.DbContexts;
using EntityFramework.Entities;
using Model;
ChampionEntity dave = new ChampionEntity()
{
Name = "Dave",
Bio = "Le meilleur Jazzman de France",
Icon = "aaa"
};
using (var context = new ChampionDbContext())
{
// Crée des nounours et les insère dans la base
Console.WriteLine("Creates and inserts new Champion");
context.Add(dave);
context.SaveChanges();
}

Loading…
Cancel
Save