From aafbadfe1f3ebec2e60ee974e7180ce50b81751f Mon Sep 17 00:00:00 2001 From: "Daniel Mackay [SSW]" <2636640+danielmackay@users.noreply.github.com> Date: Wed, 10 May 2023 08:29:59 +1000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=2063=20make=20events=20recor?= =?UTF-8?q?d=20based=20(#64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Domain events now use records. * Don't allow prerelease version of .NET --- global.json | 3 ++- src/Domain/Common/BaseEvent.cs | 5 +---- src/Domain/Events/TodoItemCreatedEvent.cs | 7 +------ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/global.json b/global.json index c4481eec..59bfd337 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,7 @@ { "sdk": { "version": "7.0.200", - "rollForward": "latestFeature" + "rollForward": "latestFeature", + "allowPrerelease": false } } \ No newline at end of file diff --git a/src/Domain/Common/BaseEvent.cs b/src/Domain/Common/BaseEvent.cs index e7f8a999..d9169d48 100644 --- a/src/Domain/Common/BaseEvent.cs +++ b/src/Domain/Common/BaseEvent.cs @@ -2,7 +2,4 @@ namespace Domain.Common; -public class BaseEvent : INotification -{ - -} \ No newline at end of file +public record BaseEvent : INotification; diff --git a/src/Domain/Events/TodoItemCreatedEvent.cs b/src/Domain/Events/TodoItemCreatedEvent.cs index 53e69af4..4d81a747 100644 --- a/src/Domain/Events/TodoItemCreatedEvent.cs +++ b/src/Domain/Events/TodoItemCreatedEvent.cs @@ -2,9 +2,4 @@ namespace Domain.Events; -public class TodoItemCreatedEvent : BaseEvent -{ - public TodoItemCreatedEvent(TodoItem item) => Item = item; - - public TodoItem Item { get; } -} \ No newline at end of file +public record TodoItemCreatedEvent(TodoItem Item) : BaseEvent;