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:
16
DefensiveProgramming/Using/C.cs
Normal file
16
DefensiveProgramming/Using/C.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Using;
|
||||
|
||||
class C : IDisposable
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public void Dispose()
|
||||
{
|
||||
Console.WriteLine("** {0} : Dispose **", Id);
|
||||
}
|
||||
|
||||
public C(string id)
|
||||
{
|
||||
Id = id;
|
||||
Console.WriteLine("----> {0} : Ctor", Id);
|
||||
}
|
||||
}
|
||||
20
DefensiveProgramming/Using/Program.cs
Normal file
20
DefensiveProgramming/Using/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Using;
|
||||
|
||||
try
|
||||
{
|
||||
C a1 = new C("A1");
|
||||
|
||||
using (C b2 = new C("B2"))
|
||||
using (C d4 = new C("D4"))
|
||||
{
|
||||
C c3 = new C("C3");
|
||||
throw new Exception("It is time for an exception");
|
||||
}
|
||||
a1.Dispose();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine("Exc: " + exc.Message);
|
||||
//throw exc;
|
||||
//throw;
|
||||
}
|
||||
10
DefensiveProgramming/Using/Using.csproj
Normal file
10
DefensiveProgramming/Using/Using.csproj
Normal 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>
|
||||
Reference in New Issue
Block a user