top-level main programs

This commit is contained in:
Oli Sturm
2026-04-22 13:48:24 +01:00
parent 1b5239566a
commit 1f24bea336
5 changed files with 51 additions and 84 deletions
@@ -8,7 +8,8 @@ public delegate Account? LoadAccount(Guid id);
public delegate void SaveAccount(Account accunt);
// If we don't want to use tuples or really miss the interface idea, we can create a named container
// If we don't want to use tuples, or you really miss the idea of a combined "interface",
// we can create a named container
// public sealed record AccountPersistence(LoadAccount Load, SaveAccount Save);
public static class InMemoryAccount
+1 -11
View File
@@ -2,12 +2,6 @@
using CsharpFp1.Domain;
using CsharpFp1.Infrastructure;
namespace CsharpFp1;
public class Program
{
public static void Main()
{
Console.WriteLine("[csharp-fp1] Starting withdraw money demo...");
var (loadAccount, saveAccount) = InMemoryAccount.Create();
@@ -18,11 +12,7 @@ public class Program
saveAccount(new Account(accountId, new Money(200m)));
decimal amount = 100m;
Console.WriteLine(
$"[csharp-fp1] Executing withdrawal {amount:0.00} from account {accountId}"
);
Console.WriteLine($"[csharp-fp1] Executing withdrawal {amount:0.00} from account {accountId}");
withdrawMoney(accountId, amount);
Console.WriteLine("[csharp-fp1] Demo completed.");
}
}
-8
View File
@@ -2,12 +2,6 @@
using CsharpOopSimplified1.Domain;
using CsharpOopSimplified1.Infrastructure;
namespace CsharpOopSimplified1;
public class Program
{
public static void Main()
{
Console.WriteLine("[csharp-oop-simplified1] Starting withdraw money demo...");
var repository = new InMemoryAccountRepository();
@@ -25,5 +19,3 @@ public class Program
AccountApplicationService.WithdrawMoney(repository, accountId, amount);
Console.WriteLine("[csharp-oop-simplified1] Demo completed.");
}
}
-8
View File
@@ -2,12 +2,6 @@
using CsharpFp1.Domain;
using CsharpFp1.Infrastructure;
namespace CsharpFp1;
public class Program
{
public static void Main()
{
Console.WriteLine("[csharp-oop-simplified2] Starting withdraw money demo...");
var repository = new InMemoryAccountRepository();
@@ -25,5 +19,3 @@ public class Program
AccountApplicationService.WithdrawMoney(repository, accountId, amount);
Console.WriteLine("[csharp-oop-simplified2] Demo completed.");
}
}
-8
View File
@@ -3,12 +3,6 @@ using CsharpOop.Contracts;
using CsharpOop.Domain;
using CsharpOop.Infrastructure;
namespace CsharpOop;
public class Program
{
public static void Main()
{
Console.WriteLine("[csharp-oop] Starting withdraw money demo...");
var repository = new InMemoryAccountRepository();
@@ -26,5 +20,3 @@ public class Program
handler.Handle(command);
Console.WriteLine("[csharp-oop] Demo completed.");
}
}