diff --git a/README.md b/README.md index 614013a..8b1bae1 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,36 @@ An application showing the absolute basics of event sourcing with [EventStoreDB (ESDB)](https://www.eventstore.com/). + ## 💡 Inspiration Inspired by Nick Chapsas' video about [getting started with Event Sourcing in .NET](https://www.youtube.com/watch?v=n_o-xuuVtmw). This take however uses EventStoreDB as its, well, store of events! -### 🤔 Mini-Log / Thoughts / Brian Dump -- **2024-May-21**: +### 📄 Mini-Log / 🤔 Thoughts / 🧠 Brain Dump + +This is not an Architectural Decision Records (ADRs) log. [This is just a tribute 🎶🎸](https://www.youtube.com/watch?v=Vdq3BtWDRq8). + +
+ 2024-May-21 + - For clarity, renamed the .NET console application projects. +
+
+ 2024-May-21 - Updated some code, fixed some bugs and typos. - Decided this repository will have multiple versions. - One that works nearly the same as Nick's original in-memory incarnation. - Another using ESDB and some of the most frequently used commands with the ESDB .NET client. - Could have a potential third version if there is some demand from the community. - Would appreciate feedback. That and questions could extend this even further, perhaps. -- **2024-May-20**: +
+
+ 2024-May-20 - Watched Nick's initial video. Awesome. Wait, what if we did the same thing, but with ESDB? - Made this code repository and .NET solution. - Only the bare bones as of this commit. Will update to include some event sourcing best practices without "getting into the weeds" too much. +
+ ## 📺 Companion Video @@ -26,6 +39,7 @@ A video will be posted on my [YouTube channel](https://www.youtube.com/@event-so Ideally on my birthday, May 22nd! + ## 🐋 Requirements 1. [Docker](https://www.docker.com/products/docker-desktop/) @@ -89,6 +103,7 @@ dotnet run --project .\StudentEnrollment01\StudentEnrollment01.csproj Instructions will go here, but will basically be the same as above! + ## 🔗 Resources Erik Shafer (me): @@ -101,6 +116,7 @@ Nick Chapsas: - [youtube.com/@nickchapsas](https://www.youtube.com/@nickchapsas) - YouTube channel - [Dometrain](https://dometrain.com/) - Courses crafted by real engineers for the real world. + ## License To Be Determined. diff --git a/StudentEnrollment00/Events/Event.cs b/StudentEnrollment01.InMemory/Events/Event.cs similarity index 72% rename from StudentEnrollment00/Events/Event.cs rename to StudentEnrollment01.InMemory/Events/Event.cs index f98a116..d015937 100644 --- a/StudentEnrollment00/Events/Event.cs +++ b/StudentEnrollment01.InMemory/Events/Event.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment00.Events; +namespace StudentEnrollment01.InMemory.Events; public abstract class Event { diff --git a/StudentEnrollment00/Events/StudentCreated.cs b/StudentEnrollment01.InMemory/Events/StudentCreated.cs similarity index 86% rename from StudentEnrollment00/Events/StudentCreated.cs rename to StudentEnrollment01.InMemory/Events/StudentCreated.cs index 5dd0e21..022cdf1 100644 --- a/StudentEnrollment00/Events/StudentCreated.cs +++ b/StudentEnrollment01.InMemory/Events/StudentCreated.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment00.Events; +namespace StudentEnrollment01.InMemory.Events; public class StudentCreated : Event { diff --git a/StudentEnrollment00/Events/StudentEnrolled.cs b/StudentEnrollment01.InMemory/Events/StudentEnrolled.cs similarity index 80% rename from StudentEnrollment00/Events/StudentEnrolled.cs rename to StudentEnrollment01.InMemory/Events/StudentEnrolled.cs index f75c385..f55a988 100644 --- a/StudentEnrollment00/Events/StudentEnrolled.cs +++ b/StudentEnrollment01.InMemory/Events/StudentEnrolled.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment00.Events; +namespace StudentEnrollment01.InMemory.Events; public class StudentEnrolled : Event { diff --git a/StudentEnrollment00/Events/StudentUnEnrolled.cs b/StudentEnrollment01.InMemory/Events/StudentUnEnrolled.cs similarity index 80% rename from StudentEnrollment00/Events/StudentUnEnrolled.cs rename to StudentEnrollment01.InMemory/Events/StudentUnEnrolled.cs index be810b7..4490279 100644 --- a/StudentEnrollment00/Events/StudentUnEnrolled.cs +++ b/StudentEnrollment01.InMemory/Events/StudentUnEnrolled.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment00.Events; +namespace StudentEnrollment01.InMemory.Events; public class StudentUnEnrolled : Event { diff --git a/StudentEnrollment00/Events/StudentUpdated.cs b/StudentEnrollment01.InMemory/Events/StudentUpdated.cs similarity index 83% rename from StudentEnrollment00/Events/StudentUpdated.cs rename to StudentEnrollment01.InMemory/Events/StudentUpdated.cs index 9c293f9..5026e57 100644 --- a/StudentEnrollment00/Events/StudentUpdated.cs +++ b/StudentEnrollment01.InMemory/Events/StudentUpdated.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment00.Events; +namespace StudentEnrollment01.InMemory.Events; public class StudentUpdated : Event { diff --git a/StudentEnrollment00/InMemoryDatabase.cs b/StudentEnrollment01.InMemory/InMemoryDatabase.cs similarity index 91% rename from StudentEnrollment00/InMemoryDatabase.cs rename to StudentEnrollment01.InMemory/InMemoryDatabase.cs index f0643ee..dbc881e 100644 --- a/StudentEnrollment00/InMemoryDatabase.cs +++ b/StudentEnrollment01.InMemory/InMemoryDatabase.cs @@ -1,6 +1,6 @@ -using StudentEnrollment00.Events; +using StudentEnrollment01.InMemory.Events; -namespace StudentEnrollment00; +namespace StudentEnrollment01.InMemory; public sealed class InMemoryDatabase { diff --git a/StudentEnrollment00/Program.cs b/StudentEnrollment01.InMemory/Program.cs similarity index 88% rename from StudentEnrollment00/Program.cs rename to StudentEnrollment01.InMemory/Program.cs index 8b71044..d1f009a 100644 --- a/StudentEnrollment00/Program.cs +++ b/StudentEnrollment01.InMemory/Program.cs @@ -1,5 +1,5 @@ -using StudentEnrollment00; -using StudentEnrollment00.Events; +using StudentEnrollment01.InMemory; +using StudentEnrollment01.InMemory.Events; var id = Guid.Parse("a662d446-4920-415e-8c2a-0dd4a6c58908"); var now = DateTime.Now; diff --git a/StudentEnrollment00/Student.cs b/StudentEnrollment01.InMemory/Student.cs similarity index 94% rename from StudentEnrollment00/Student.cs rename to StudentEnrollment01.InMemory/Student.cs index 75c7596..10b6595 100644 --- a/StudentEnrollment00/Student.cs +++ b/StudentEnrollment01.InMemory/Student.cs @@ -1,6 +1,6 @@ -using StudentEnrollment00.Events; +using StudentEnrollment01.InMemory.Events; -namespace StudentEnrollment00; +namespace StudentEnrollment01.InMemory; public class Student { diff --git a/StudentEnrollment00/StudentEnrollment00.csproj b/StudentEnrollment01.InMemory/StudentEnrollment01.InMemory.csproj similarity index 100% rename from StudentEnrollment00/StudentEnrollment00.csproj rename to StudentEnrollment01.InMemory/StudentEnrollment01.InMemory.csproj diff --git a/StudentEnrollment01/Events/Event.cs b/StudentEnrollment02.Esdb/Events/Event.cs similarity index 74% rename from StudentEnrollment01/Events/Event.cs rename to StudentEnrollment02.Esdb/Events/Event.cs index 5c343f5..ec0fac2 100644 --- a/StudentEnrollment01/Events/Event.cs +++ b/StudentEnrollment02.Esdb/Events/Event.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public abstract record Event { diff --git a/StudentEnrollment01/Events/EventTypeMapper.cs b/StudentEnrollment02.Esdb/Events/EventTypeMapper.cs similarity index 96% rename from StudentEnrollment01/Events/EventTypeMapper.cs rename to StudentEnrollment02.Esdb/Events/EventTypeMapper.cs index 438d801..a1f9f95 100644 --- a/StudentEnrollment01/Events/EventTypeMapper.cs +++ b/StudentEnrollment02.Esdb/Events/EventTypeMapper.cs @@ -1,6 +1,6 @@ using System.Collections.Concurrent; -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public class EventTypeMapper { diff --git a/StudentEnrollment01/Events/StudentCreated.cs b/StudentEnrollment02.Esdb/Events/StudentCreated.cs similarity index 85% rename from StudentEnrollment01/Events/StudentCreated.cs rename to StudentEnrollment02.Esdb/Events/StudentCreated.cs index 2c4354d..bd9014a 100644 --- a/StudentEnrollment01/Events/StudentCreated.cs +++ b/StudentEnrollment02.Esdb/Events/StudentCreated.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public record StudentCreated : Event { diff --git a/StudentEnrollment01/Events/StudentEmailChanged.cs b/StudentEnrollment02.Esdb/Events/StudentEmailChanged.cs similarity index 76% rename from StudentEnrollment01/Events/StudentEmailChanged.cs rename to StudentEnrollment02.Esdb/Events/StudentEmailChanged.cs index f7aa0b5..3c241b6 100644 --- a/StudentEnrollment01/Events/StudentEmailChanged.cs +++ b/StudentEnrollment02.Esdb/Events/StudentEmailChanged.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public record StudentEmailChanged : Event { diff --git a/StudentEnrollment01/Events/StudentEnrolled.cs b/StudentEnrollment02.Esdb/Events/StudentEnrolled.cs similarity index 77% rename from StudentEnrollment01/Events/StudentEnrolled.cs rename to StudentEnrollment02.Esdb/Events/StudentEnrolled.cs index 560e1a7..eef1def 100644 --- a/StudentEnrollment01/Events/StudentEnrolled.cs +++ b/StudentEnrollment02.Esdb/Events/StudentEnrolled.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public record StudentEnrolled : Event { diff --git a/StudentEnrollment01/Events/StudentWithdrawn.cs b/StudentEnrollment02.Esdb/Events/StudentWithdrawn.cs similarity index 77% rename from StudentEnrollment01/Events/StudentWithdrawn.cs rename to StudentEnrollment02.Esdb/Events/StudentWithdrawn.cs index 1e8944d..6130737 100644 --- a/StudentEnrollment01/Events/StudentWithdrawn.cs +++ b/StudentEnrollment02.Esdb/Events/StudentWithdrawn.cs @@ -1,4 +1,4 @@ -namespace StudentEnrollment01.Events; +namespace StudentEnrollment02.Esdb.Events; public record StudentWithdrawn : Event { diff --git a/StudentEnrollment01/Program.cs b/StudentEnrollment02.Esdb/Program.cs similarity index 98% rename from StudentEnrollment01/Program.cs rename to StudentEnrollment02.Esdb/Program.cs index 4b17950..a57f729 100644 --- a/StudentEnrollment01/Program.cs +++ b/StudentEnrollment02.Esdb/Program.cs @@ -1,7 +1,7 @@ using System.Text; using System.Text.Json; using EventStore.Client; -using StudentEnrollment01.Events; +using StudentEnrollment02.Esdb.Events; // Register events to a singleton for ease-of-reference EventTypeMapper.Instance.ToName(typeof(StudentCreated)); diff --git a/StudentEnrollment01/Student.cs b/StudentEnrollment02.Esdb/Student.cs similarity index 95% rename from StudentEnrollment01/Student.cs rename to StudentEnrollment02.Esdb/Student.cs index b15c7c4..4db4ae7 100644 --- a/StudentEnrollment01/Student.cs +++ b/StudentEnrollment02.Esdb/Student.cs @@ -1,6 +1,6 @@ -using StudentEnrollment01.Events; +using StudentEnrollment02.Esdb.Events; -namespace StudentEnrollment01; +namespace StudentEnrollment02.Esdb; public class Student { diff --git a/StudentEnrollment01/StudentEnrollment01.csproj b/StudentEnrollment02.Esdb/StudentEnrollment02.Esdb.csproj similarity index 100% rename from StudentEnrollment01/StudentEnrollment01.csproj rename to StudentEnrollment02.Esdb/StudentEnrollment02.Esdb.csproj diff --git a/StudentEnrollmentConsoleApp.sln b/StudentEnrollmentConsoleApp.sln index 09543ff..e610f79 100644 --- a/StudentEnrollmentConsoleApp.sln +++ b/StudentEnrollmentConsoleApp.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollment01", "StudentEnrollment01\StudentEnrollment01.csproj", "{446FF6B7-B58B-4CFB-8E98-C5B3AED9BA4D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollment02.Esdb", "StudentEnrollment02.Esdb\StudentEnrollment02.Esdb.csproj", "{446FF6B7-B58B-4CFB-8E98-C5B3AED9BA4D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{43721FA4-09D5-4B98-9684-8752B40047AD}" ProjectSection(SolutionItems) = preProject @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollment00", "StudentEnrollment00\StudentEnrollment00.csproj", "{B8D543AF-F986-4E50-AD1D-492B38A58ECF}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentEnrollment01.InMemory", "StudentEnrollment01.InMemory\StudentEnrollment01.InMemory.csproj", "{B8D543AF-F986-4E50-AD1D-492B38A58ECF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution