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:
Boris Milašinović
2026-04-19 16:49:07 +02:00
parent 44a663e170
commit 6f56d107a2
89 changed files with 7305 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,26 @@
using System;
namespace Delegates;
public class MathTool
{
public static int Sum(int x, int y)
{
return x + y;
}
public static int Diff(int x, int y)
{
return x - y;
}
public static void PrintSquare(int x)
{
Console.WriteLine("x^2 = " + x * x);
}
public static void PrintSquareRoot(int x)
{
Console.WriteLine("sqrt(x) = " + Math.Sqrt(x));
}
}

View File

@@ -0,0 +1,31 @@
namespace Delegates;
class Program
{
public delegate int MathFunction(int a, int b);
public delegate void PrintFunction(int n);
static void Main(string[] args)
{
int x = 16, y = 2;
MathFunction mf = MathTool.Sum;
Console.WriteLine("mf({0}, {1}) = {2}", x, y, mf(x, y));
mf = MathTool.Diff;
Console.WriteLine("mf({0}, {1}) = {2}", x, y, mf(x, y));
PrintFunction pf = MathTool.PrintSquare;
pf += MathTool.PrintSquareRoot;
pf(x);
#pragma warning disable CS8601 // Possible null reference assignment.
pf -= MathTool.PrintSquare;
#pragma warning restore CS8601 // Possible null reference assignment.
Console.WriteLine();
#pragma warning disable CS8602 // Dereference of a possibly null reference.
pf(y); //instead of pragma pf?.Invoke(y); can be used
#pragma warning restore CS8602 // Dereference of a possibly null reference.
Func<int, int, int> func = MathTool.Sum;
Console.WriteLine("func({0}, {1}) = {2}", x, y, func(x, y));
Action<int> action = MathTool.PrintSquare;
action(x);
}
}