PI06 i PI06-1. Docker definitions for MSSQL and Postgres. Data seeder/generator for countries and people. Entity Framework example with variants for Postgres and MSSQL
This commit is contained in:
21
DataAccess/EF_Demo/Program.cs
Normal file
21
DataAccess/EF_Demo/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using EF_Demo;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
using ServiceProvider serviceProvider = DISetup.BuildDI();
|
||||
|
||||
Demo.PrintPeople(serviceProvider, 1976);
|
||||
Util.EnterToContinue();
|
||||
|
||||
int? eventId = Demo.AddEvent(serviceProvider, "Spring festival", new DateOnly(2026, 4, 30));
|
||||
Util.EnterToContinue();
|
||||
|
||||
if (eventId.HasValue)
|
||||
{
|
||||
Demo.PostponeEvent(serviceProvider, eventId.Value, days: 5);
|
||||
Util.EnterToContinue();
|
||||
|
||||
Demo.DeleteEvent(serviceProvider, eventId.Value);
|
||||
Util.EnterToContinue(clearConsole: false);
|
||||
}
|
||||
Reference in New Issue
Block a user