Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming .NET Projects #2

Merged
merged 5 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,44 @@

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).

<details>
<summary><strong>2024-May-21</strong></summary>
- For clarity, renamed the .NET console application projects.
</details>
<details>
<summary><strong>2024-May-21</strong></summary>
- 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**:
</details>
<details>
<summary><strong>2024-May-20</strong></summary>
- 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.
</details>


## 📺 Companion Video

A video will be posted on my [YouTube channel](https://www.youtube.com/@event-sourcing) soon.

Ideally on my birthday, May 22nd!


## 🐋 Requirements

1. [Docker](https://www.docker.com/products/docker-desktop/)
Expand Down Expand Up @@ -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):
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment00.Events;
namespace StudentEnrollment01.InMemory.Events;

public abstract class Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment00.Events;
namespace StudentEnrollment01.InMemory.Events;

public class StudentCreated : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment00.Events;
namespace StudentEnrollment01.InMemory.Events;

public class StudentEnrolled : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment00.Events;
namespace StudentEnrollment01.InMemory.Events;

public class StudentUnEnrolled : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment00.Events;
namespace StudentEnrollment01.InMemory.Events;

public class StudentUpdated : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using StudentEnrollment00.Events;
using StudentEnrollment01.InMemory.Events;

namespace StudentEnrollment00;
namespace StudentEnrollment01.InMemory;

public sealed class InMemoryDatabase
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using StudentEnrollment00.Events;
using StudentEnrollment01.InMemory.Events;

namespace StudentEnrollment00;
namespace StudentEnrollment01.InMemory;

public class Student
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public abstract record Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Concurrent;

namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public class EventTypeMapper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public record StudentCreated : Event
{
public required string FullName { get; init; }
public required string Email { get; init; }
public required DateTime DateOfBirth { get; init; }
public DateTime CreatedAtUtc { get; init; }

Check warning on line 8 in StudentEnrollment02.Esdb/Events/StudentCreated.cs

View workflow job for this annotation

GitHub Actions / build

'StudentCreated.CreatedAtUtc' hides inherited member 'Event.CreatedAtUtc'. Use the new keyword if hiding was intended.

Check warning on line 8 in StudentEnrollment02.Esdb/Events/StudentCreated.cs

View workflow job for this annotation

GitHub Actions / build

'StudentCreated.CreatedAtUtc' hides inherited member 'Event.CreatedAtUtc'. Use the new keyword if hiding was intended.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public record StudentEmailChanged : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public record StudentEnrolled : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace StudentEnrollment01.Events;
namespace StudentEnrollment02.Esdb.Events;

public record StudentWithdrawn : Event
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using StudentEnrollment01.Events;
using StudentEnrollment02.Esdb.Events;

namespace StudentEnrollment01;
namespace StudentEnrollment02.Esdb;

public class Student
{
Expand Down
4 changes: 2 additions & 2 deletions StudentEnrollmentConsoleApp.sln
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down