From c7e20a7780e50bf77f11a0986dae782b754bbfa8 Mon Sep 17 00:00:00 2001 From: Francis Pion Date: Mon, 25 Mar 2024 22:18:23 -0400 Subject: [PATCH] Many features. (#58) * Upgraded NuGet packages. * Removed EventDb. * Clean domain events and use the new Raise methods. --- .../Logitar.Identity.Demo.csproj | 2 +- .../ApiKeys/ApiKeyAggregate.cs | 15 ++++---- .../Events/ApiKeyAuthenticatedEvent.cs | 12 +----- .../ApiKeys/Events/ApiKeyCreatedEvent.cs | 4 +- .../ApiKeys/Events/ApiKeyDeletedEvent.cs | 4 +- .../ApiKeys/Events/ApiKeyRoleAddedEvent.cs | 4 +- .../ApiKeys/Events/ApiKeyRoleRemovedEvent.cs | 4 +- .../Logitar.Identity.Domain.csproj | 8 ++-- .../Events/OneTimePasswordCreatedEvent.cs | 4 +- .../Events/OneTimePasswordDeletedEvent.cs | 4 +- .../OneTimePasswordValidationFailedEvent.cs | 12 +----- ...OneTimePasswordValidationSucceededEvent.cs | 12 +----- .../Passwords/OneTimePasswordAggregate.cs | 11 +++--- .../Roles/Events/RoleCreatedEvent.cs | 4 +- .../Roles/Events/RoleDeletedEvent.cs | 4 +- .../Events/RoleUniqueNameChangedEvent.cs | 4 +- .../Roles/RoleAggregate.cs | 9 ++--- .../Sessions/Events/SessionCreatedEvent.cs | 4 +- .../Sessions/Events/SessionDeletedEvent.cs | 4 +- .../Sessions/Events/SessionRenewedEvent.cs | 4 +- .../Sessions/Events/SessionSignedOutEvent.cs | 12 +----- .../Sessions/SessionAggregate.cs | 11 +++--- .../Users/Events/UserAddressChangedEvent.cs | 4 +- .../Users/Events/UserAuthenticatedEvent.cs | 12 +----- .../Users/Events/UserCreatedEvent.cs | 4 +- .../Users/Events/UserDeletedEvent.cs | 4 +- .../Users/Events/UserDisabledEvent.cs | 12 +----- .../Users/Events/UserEmailChangedEvent.cs | 4 +- .../Users/Events/UserEnabledEvent.cs | 12 +----- .../Events/UserIdentifierChangedEvent.cs | 4 +- .../Events/UserIdentifierRemovedEvent.cs | 4 +- .../Users/Events/UserPasswordChangedEvent.cs | 6 +-- .../Users/Events/UserPasswordEvent.cs | 4 +- .../Users/Events/UserPasswordResetEvent.cs | 6 +-- .../Users/Events/UserPasswordUpdatedEvent.cs | 6 +-- .../Users/Events/UserPhoneChangedEvent.cs | 4 +- .../Users/Events/UserRoleAddedEvent.cs | 4 +- .../Users/Events/UserRoleRemovedEvent.cs | 4 +- .../Users/Events/UserSignedInEvent.cs | 4 +- .../Events/UserUniqueNameChangedEvent.cs | 4 +- .../Users/UserAggregate.cs | 37 +++++++++---------- ...tity.EntityFrameworkCore.PostgreSQL.csproj | 2 +- .../EventDb.cs | 23 ------------ ...tity.EntityFrameworkCore.Relational.csproj | 2 +- ...ntity.EntityFrameworkCore.SqlServer.csproj | 2 +- .../Logitar.Identity.Infrastructure.csproj | 6 +-- .../Logitar.Identity.Domain.UnitTests.csproj | 4 +- ....EFCore.PostgreSQL.IntegrationTests.csproj | 2 +- ....EFCore.Relational.IntegrationTests.csproj | 2 +- .../SessionRepositoryTestsBase.cs | 1 + ...y.EFCore.SqlServer.IntegrationTests.csproj | 2 +- ...r.Identity.Infrastructure.UnitTests.csproj | 2 +- .../Logitar.Identity.Tests.csproj | 4 +- 53 files changed, 97 insertions(+), 246 deletions(-) delete mode 100644 src/Logitar.Identity.EntityFrameworkCore.Relational/EventDb.cs diff --git a/src/Logitar.Identity.Demo/Logitar.Identity.Demo.csproj b/src/Logitar.Identity.Demo/Logitar.Identity.Demo.csproj index 241724a..11a467b 100644 --- a/src/Logitar.Identity.Demo/Logitar.Identity.Demo.csproj +++ b/src/Logitar.Identity.Demo/Logitar.Identity.Demo.csproj @@ -26,7 +26,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Logitar.Identity.Domain/ApiKeys/ApiKeyAggregate.cs b/src/Logitar.Identity.Domain/ApiKeys/ApiKeyAggregate.cs index 1dcfc30..5b13e78 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/ApiKeyAggregate.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/ApiKeyAggregate.cs @@ -88,7 +88,7 @@ public ApiKeyAggregate(AggregateId id) : base(id) public ApiKeyAggregate(DisplayNameUnit displayName, Password secret, TenantId? tenantId = null, ActorId actorId = default, ApiKeyId? id = null) : base((id ?? ApiKeyId.NewId()).AggregateId) { - Raise(new ApiKeyCreatedEvent(actorId, displayName, secret, tenantId)); + Raise(new ApiKeyCreatedEvent(displayName, secret, tenantId), actorId); } /// /// Applies the specified event. @@ -135,7 +135,7 @@ public void AddRole(RoleAggregate role, ActorId actorId = default) if (!HasRole(role)) { - Raise(new ApiKeyRoleAddedEvent(actorId, role.Id)); + Raise(new ApiKeyRoleAddedEvent(role.Id), actorId); } } /// @@ -166,7 +166,7 @@ public void Authenticate(string secret, ActorId? actorId = null) } actorId ??= new(Id.Value); - Raise(new ApiKeyAuthenticatedEvent(actorId.Value)); + Raise(new ApiKeyAuthenticatedEvent(), actorId.Value); } /// /// Applies the specified event. @@ -185,7 +185,7 @@ public void Delete(ActorId actorId = default) { if (!IsDeleted) { - Raise(new ApiKeyDeletedEvent(actorId)); + Raise(new ApiKeyDeletedEvent(), actorId); } } @@ -227,7 +227,7 @@ public void RemoveRole(RoleAggregate role, ActorId actorId = default) { if (HasRole(role)) { - Raise(new ApiKeyRoleRemovedEvent(actorId, role.Id)); + Raise(new ApiKeyRoleRemovedEvent(role.Id), actorId); } } /// @@ -282,8 +282,7 @@ public void Update(ActorId actorId = default) { if (_updatedEvent.HasChanges) { - _updatedEvent.ActorId = actorId; - Raise(_updatedEvent); + Raise(_updatedEvent, actorId, DateTime.Now); _updatedEvent = new(); } } @@ -325,3 +324,5 @@ protected virtual void Apply(ApiKeyUpdatedEvent @event) /// The string representation. public override string ToString() => $"{DisplayName.Value} | {base.ToString()}"; } + +// Added: Aggregate Raise methods. diff --git a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyAuthenticatedEvent.cs b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyAuthenticatedEvent.cs index 8a42109..5e76284 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyAuthenticatedEvent.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyAuthenticatedEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.ApiKeys.Events; /// /// The event raised when an API key is authenticated. /// -public record ApiKeyAuthenticatedEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public ApiKeyAuthenticatedEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record ApiKeyAuthenticatedEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyCreatedEvent.cs b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyCreatedEvent.cs index c2e3af6..56b979b 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyCreatedEvent.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyCreatedEvent.cs @@ -28,13 +28,11 @@ public record ApiKeyCreatedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The display name of the API key. /// The secret of the API key. /// The tenant identifier of the API key. - public ApiKeyCreatedEvent(ActorId actorId, DisplayNameUnit displayName, Password secret, TenantId? tenantId) + public ApiKeyCreatedEvent(DisplayNameUnit displayName, Password secret, TenantId? tenantId) { - ActorId = actorId; DisplayName = displayName; Secret = secret; TenantId = tenantId; diff --git a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyDeletedEvent.cs b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyDeletedEvent.cs index 668e7a5..2fb8315 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyDeletedEvent.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyDeletedEvent.cs @@ -11,10 +11,8 @@ public record ApiKeyDeletedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. - public ApiKeyDeletedEvent(ActorId actorId) + public ApiKeyDeletedEvent() { - ActorId = actorId; IsDeleted = true; } } diff --git a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleAddedEvent.cs b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleAddedEvent.cs index 573e6b6..9d49b17 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleAddedEvent.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleAddedEvent.cs @@ -17,11 +17,9 @@ public record ApiKeyRoleAddedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The role identifier. - public ApiKeyRoleAddedEvent(ActorId actorId, RoleId roleId) + public ApiKeyRoleAddedEvent(RoleId roleId) { - ActorId = actorId; RoleId = roleId; } } diff --git a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleRemovedEvent.cs b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleRemovedEvent.cs index e4f8ed1..77c2426 100644 --- a/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleRemovedEvent.cs +++ b/src/Logitar.Identity.Domain/ApiKeys/Events/ApiKeyRoleRemovedEvent.cs @@ -17,11 +17,9 @@ public record ApiKeyRoleRemovedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The role identifier. - public ApiKeyRoleRemovedEvent(ActorId actorId, RoleId roleId) + public ApiKeyRoleRemovedEvent(RoleId roleId) { - ActorId = actorId; RoleId = roleId; } } diff --git a/src/Logitar.Identity.Domain/Logitar.Identity.Domain.csproj b/src/Logitar.Identity.Domain/Logitar.Identity.Domain.csproj index 7dab509..5dfbf25 100644 --- a/src/Logitar.Identity.Domain/Logitar.Identity.Domain.csproj +++ b/src/Logitar.Identity.Domain/Logitar.Identity.Domain.csproj @@ -52,13 +52,13 @@ - - + + - - + + diff --git a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordCreatedEvent.cs b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordCreatedEvent.cs index 52567b2..8c7d4c7 100644 --- a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordCreatedEvent.cs +++ b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordCreatedEvent.cs @@ -31,14 +31,12 @@ public record OneTimePasswordCreatedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The expiration date and time of the One-Time Password (OTP). /// The maximum number of attempts of the One-Time Password (OTP). /// The encoded value of the One-Time Password (OTP). /// The tenant identifier of the One-Time Password (OTP). - public OneTimePasswordCreatedEvent(ActorId actorId, DateTime? expiresOn, int? maximumAttempts, Password password, TenantId? tenantId) + public OneTimePasswordCreatedEvent(DateTime? expiresOn, int? maximumAttempts, Password password, TenantId? tenantId) { - ActorId = actorId; ExpiresOn = expiresOn; MaximumAttempts = maximumAttempts; Password = password; diff --git a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordDeletedEvent.cs b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordDeletedEvent.cs index 81fcdf3..555b6f9 100644 --- a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordDeletedEvent.cs +++ b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordDeletedEvent.cs @@ -11,10 +11,8 @@ public record OneTimePasswordDeletedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. - public OneTimePasswordDeletedEvent(ActorId actorId) + public OneTimePasswordDeletedEvent() { - ActorId = actorId; IsDeleted = true; } } diff --git a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationFailedEvent.cs b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationFailedEvent.cs index a472bce..fe03f67 100644 --- a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationFailedEvent.cs +++ b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationFailedEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Passwords.Events; /// /// The event raised when a One-Time Password (OTP) validation failed. /// -public record OneTimePasswordValidationFailedEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public OneTimePasswordValidationFailedEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record OneTimePasswordValidationFailedEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationSucceededEvent.cs b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationSucceededEvent.cs index 883f9d0..44b4bbc 100644 --- a/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationSucceededEvent.cs +++ b/src/Logitar.Identity.Domain/Passwords/Events/OneTimePasswordValidationSucceededEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Passwords.Events; /// /// The event raised when a One-Time Password (OTP) is successfully validated. /// -public record OneTimePasswordValidationSucceededEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public OneTimePasswordValidationSucceededEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record OneTimePasswordValidationSucceededEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Passwords/OneTimePasswordAggregate.cs b/src/Logitar.Identity.Domain/Passwords/OneTimePasswordAggregate.cs index d45e911..d7137e3 100644 --- a/src/Logitar.Identity.Domain/Passwords/OneTimePasswordAggregate.cs +++ b/src/Logitar.Identity.Domain/Passwords/OneTimePasswordAggregate.cs @@ -80,7 +80,7 @@ public OneTimePasswordAggregate(Password password, TenantId? tenantId = null, Da new MaximumAttemptsValidator().ValidateAndThrow(maximumAttempts.Value); } - Raise(new OneTimePasswordCreatedEvent(actorId, expiresOn, maximumAttempts, password, tenantId)); + Raise(new OneTimePasswordCreatedEvent(expiresOn, maximumAttempts, password, tenantId), actorId); } /// /// Applies the specified event. @@ -104,7 +104,7 @@ public void Delete(ActorId actorId = default) { if (!IsDeleted) { - Raise(new OneTimePasswordDeletedEvent(actorId)); + Raise(new OneTimePasswordDeletedEvent(), actorId); } } @@ -157,8 +157,7 @@ public void Update(ActorId actorId = default) { if (_updatedEvent.HasChanges) { - _updatedEvent.ActorId = actorId; - Raise(_updatedEvent); + Raise(_updatedEvent, actorId, DateTime.Now); _updatedEvent = new(); } } @@ -206,11 +205,11 @@ public void Validate(string password, ActorId actorId = default) } else if (_password == null || !_password.IsMatch(password)) { - Raise(new OneTimePasswordValidationFailedEvent(actorId)); + Raise(new OneTimePasswordValidationFailedEvent(), actorId); throw new IncorrectOneTimePasswordPasswordException(this, password); } - Raise(new OneTimePasswordValidationSucceededEvent(actorId)); + Raise(new OneTimePasswordValidationSucceededEvent(), actorId); } /// /// Applies the specified event. diff --git a/src/Logitar.Identity.Domain/Roles/Events/RoleCreatedEvent.cs b/src/Logitar.Identity.Domain/Roles/Events/RoleCreatedEvent.cs index 8c3dbec..eb772e9 100644 --- a/src/Logitar.Identity.Domain/Roles/Events/RoleCreatedEvent.cs +++ b/src/Logitar.Identity.Domain/Roles/Events/RoleCreatedEvent.cs @@ -22,12 +22,10 @@ public record RoleCreatedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The tenant identifier of the role. /// The unique name of the role. - public RoleCreatedEvent(ActorId actorId, TenantId? tenantId, UniqueNameUnit uniqueName) + public RoleCreatedEvent(TenantId? tenantId, UniqueNameUnit uniqueName) { - ActorId = actorId; TenantId = tenantId; UniqueName = uniqueName; } diff --git a/src/Logitar.Identity.Domain/Roles/Events/RoleDeletedEvent.cs b/src/Logitar.Identity.Domain/Roles/Events/RoleDeletedEvent.cs index a2afbdb..ad73780 100644 --- a/src/Logitar.Identity.Domain/Roles/Events/RoleDeletedEvent.cs +++ b/src/Logitar.Identity.Domain/Roles/Events/RoleDeletedEvent.cs @@ -11,10 +11,8 @@ public record RoleDeletedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. - public RoleDeletedEvent(ActorId actorId) + public RoleDeletedEvent() { - ActorId = actorId; IsDeleted = true; } } diff --git a/src/Logitar.Identity.Domain/Roles/Events/RoleUniqueNameChangedEvent.cs b/src/Logitar.Identity.Domain/Roles/Events/RoleUniqueNameChangedEvent.cs index 6d3db1a..3d81c45 100644 --- a/src/Logitar.Identity.Domain/Roles/Events/RoleUniqueNameChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Roles/Events/RoleUniqueNameChangedEvent.cs @@ -17,11 +17,9 @@ public record RoleUniqueNameChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The unique name of the role. - public RoleUniqueNameChangedEvent(ActorId actorId, UniqueNameUnit uniqueName) + public RoleUniqueNameChangedEvent(UniqueNameUnit uniqueName) { - ActorId = actorId; UniqueName = uniqueName; } } diff --git a/src/Logitar.Identity.Domain/Roles/RoleAggregate.cs b/src/Logitar.Identity.Domain/Roles/RoleAggregate.cs index d70c3be..a6986c2 100644 --- a/src/Logitar.Identity.Domain/Roles/RoleAggregate.cs +++ b/src/Logitar.Identity.Domain/Roles/RoleAggregate.cs @@ -93,7 +93,7 @@ public RoleAggregate(AggregateId id) : base(id) public RoleAggregate(UniqueNameUnit uniqueName, TenantId? tenantId = null, ActorId actorId = default, RoleId? id = null) : base((id ?? RoleId.NewId()).AggregateId) { - Raise(new RoleCreatedEvent(actorId, tenantId, uniqueName)); + Raise(new RoleCreatedEvent(tenantId, uniqueName), actorId); } /// /// Applies the specified event. @@ -114,7 +114,7 @@ public void Delete(ActorId actorId = default) { if (!IsDeleted) { - Raise(new RoleDeletedEvent(actorId)); + Raise(new RoleDeletedEvent(), actorId); } } @@ -161,7 +161,7 @@ public void SetUniqueName(UniqueNameUnit uniqueName, ActorId actorId = default) { if (uniqueName != _uniqueName) { - Raise(new RoleUniqueNameChangedEvent(actorId, uniqueName)); + Raise(new RoleUniqueNameChangedEvent(uniqueName), actorId); } } /// @@ -181,8 +181,7 @@ public void Update(ActorId actorId = default) { if (_updatedEvent.HasChanges) { - _updatedEvent.ActorId = actorId; - Raise(_updatedEvent); + Raise(_updatedEvent, actorId, DateTime.Now); _updatedEvent = new(); } } diff --git a/src/Logitar.Identity.Domain/Sessions/Events/SessionCreatedEvent.cs b/src/Logitar.Identity.Domain/Sessions/Events/SessionCreatedEvent.cs index cf4b7a9..21d121a 100644 --- a/src/Logitar.Identity.Domain/Sessions/Events/SessionCreatedEvent.cs +++ b/src/Logitar.Identity.Domain/Sessions/Events/SessionCreatedEvent.cs @@ -22,12 +22,10 @@ public record SessionCreatedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The secret of the session. /// The identifier of the user owning the session. - public SessionCreatedEvent(ActorId actorId, Password? secret, UserId userId) + public SessionCreatedEvent(Password? secret, UserId userId) { - ActorId = actorId; Secret = secret; UserId = userId; } diff --git a/src/Logitar.Identity.Domain/Sessions/Events/SessionDeletedEvent.cs b/src/Logitar.Identity.Domain/Sessions/Events/SessionDeletedEvent.cs index c7b0eb2..27855a2 100644 --- a/src/Logitar.Identity.Domain/Sessions/Events/SessionDeletedEvent.cs +++ b/src/Logitar.Identity.Domain/Sessions/Events/SessionDeletedEvent.cs @@ -11,10 +11,8 @@ public record SessionDeletedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. - public SessionDeletedEvent(ActorId actorId) + public SessionDeletedEvent() { - ActorId = actorId; IsDeleted = true; } } diff --git a/src/Logitar.Identity.Domain/Sessions/Events/SessionRenewedEvent.cs b/src/Logitar.Identity.Domain/Sessions/Events/SessionRenewedEvent.cs index afe8572..039d930 100644 --- a/src/Logitar.Identity.Domain/Sessions/Events/SessionRenewedEvent.cs +++ b/src/Logitar.Identity.Domain/Sessions/Events/SessionRenewedEvent.cs @@ -17,11 +17,9 @@ public record SessionRenewedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The new secret of the session. - public SessionRenewedEvent(ActorId actorId, Password secret) + public SessionRenewedEvent(Password secret) { - ActorId = actorId; Secret = secret; } } diff --git a/src/Logitar.Identity.Domain/Sessions/Events/SessionSignedOutEvent.cs b/src/Logitar.Identity.Domain/Sessions/Events/SessionSignedOutEvent.cs index 51c207a..104f0ba 100644 --- a/src/Logitar.Identity.Domain/Sessions/Events/SessionSignedOutEvent.cs +++ b/src/Logitar.Identity.Domain/Sessions/Events/SessionSignedOutEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Sessions.Events; /// /// The event raised when an active session is signed-out. /// -public record SessionSignedOutEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public SessionSignedOutEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record SessionSignedOutEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Sessions/SessionAggregate.cs b/src/Logitar.Identity.Domain/Sessions/SessionAggregate.cs index 929c016..bc52dc7 100644 --- a/src/Logitar.Identity.Domain/Sessions/SessionAggregate.cs +++ b/src/Logitar.Identity.Domain/Sessions/SessionAggregate.cs @@ -66,7 +66,7 @@ public SessionAggregate(UserAggregate user, Password? secret = null, ActorId? ac : base((id ?? SessionId.NewId()).AggregateId) { actorId ??= new(user.Id.Value); - Raise(new SessionCreatedEvent(actorId.Value, secret, user.Id)); + Raise(new SessionCreatedEvent(secret, user.Id), actorId.Value); } /// /// Applies the specified event. @@ -89,7 +89,7 @@ public void Delete(ActorId actorId = default) { if (!IsDeleted) { - Raise(new SessionDeletedEvent(actorId)); + Raise(new SessionDeletedEvent(), actorId); } } @@ -133,7 +133,7 @@ public void Renew(string currentSecret, Password newSecret, ActorId? actorId = d } actorId ??= new(UserId.Value); - Raise(new SessionRenewedEvent(actorId.Value, newSecret)); + Raise(new SessionRenewedEvent(newSecret), actorId.Value); } /// /// Applies the specified event. @@ -172,7 +172,7 @@ public void SignOut(ActorId? actorId = default) if (IsActive) { actorId ??= new(UserId.Value); - Raise(new SessionSignedOutEvent(actorId.Value)); + Raise(new SessionSignedOutEvent(), actorId.Value); } } /// @@ -192,8 +192,7 @@ public void Update(ActorId actorId = default) { if (_updatedEvent.HasChanges) { - _updatedEvent.ActorId = actorId; - Raise(_updatedEvent); + Raise(_updatedEvent, actorId, DateTime.Now); _updatedEvent = new(); } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserAddressChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserAddressChangedEvent.cs index 378267f..884eea4 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserAddressChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserAddressChangedEvent.cs @@ -16,11 +16,9 @@ public record UserAddressChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The new postal address of the user. - public UserAddressChangedEvent(ActorId actorId, AddressUnit? address) + public UserAddressChangedEvent(AddressUnit? address) { - ActorId = actorId; Address = address; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserAuthenticatedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserAuthenticatedEvent.cs index d33d0a5..9b8c0f3 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserAuthenticatedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserAuthenticatedEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Users.Events; /// /// The event raised when an user is authenticated. /// -public record UserAuthenticatedEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public UserAuthenticatedEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record UserAuthenticatedEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Users/Events/UserCreatedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserCreatedEvent.cs index cce7f17..c623f0f 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserCreatedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserCreatedEvent.cs @@ -22,12 +22,10 @@ public record UserCreatedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The tenant identifier of the user. /// The unique name of the user. - public UserCreatedEvent(ActorId actorId, TenantId? tenantId, UniqueNameUnit uniqueName) + public UserCreatedEvent(TenantId? tenantId, UniqueNameUnit uniqueName) { - ActorId = actorId; TenantId = tenantId; UniqueName = uniqueName; } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserDeletedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserDeletedEvent.cs index e6c460d..2ccf71a 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserDeletedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserDeletedEvent.cs @@ -11,10 +11,8 @@ public record UserDeletedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. - public UserDeletedEvent(ActorId actorId) + public UserDeletedEvent() { - ActorId = actorId; IsDeleted = true; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserDisabledEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserDisabledEvent.cs index 49be9e2..36a468c 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserDisabledEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserDisabledEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Users.Events; /// /// The event raised when an user is disabled. /// -public record UserDisabledEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public UserDisabledEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record UserDisabledEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Users/Events/UserEmailChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserEmailChangedEvent.cs index a82e7b5..295efe7 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserEmailChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserEmailChangedEvent.cs @@ -16,11 +16,9 @@ public record UserEmailChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The new email address of the user. - public UserEmailChangedEvent(ActorId actorId, EmailUnit? email) + public UserEmailChangedEvent(EmailUnit? email) { - ActorId = actorId; Email = email; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserEnabledEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserEnabledEvent.cs index 06ebc78..0993393 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserEnabledEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserEnabledEvent.cs @@ -6,14 +6,4 @@ namespace Logitar.Identity.Domain.Users.Events; /// /// The event raised when an user is enabled. /// -public record UserEnabledEvent : DomainEvent, INotification -{ - /// - /// Initializes a new instance of the class. - /// - /// The actor identifier. - public UserEnabledEvent(ActorId actorId) - { - ActorId = actorId; - } -} +public record UserEnabledEvent : DomainEvent, INotification; diff --git a/src/Logitar.Identity.Domain/Users/Events/UserIdentifierChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserIdentifierChangedEvent.cs index 0dff84d..7f11b0c 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserIdentifierChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserIdentifierChangedEvent.cs @@ -20,12 +20,10 @@ public record UserIdentifierChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The key of the custom identifier. /// The value of the custom identifier. - public UserIdentifierChangedEvent(ActorId actorId, string key, string value) + public UserIdentifierChangedEvent(string key, string value) { - ActorId = actorId; Key = key; Value = value; } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserIdentifierRemovedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserIdentifierRemovedEvent.cs index 5891128..b589db7 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserIdentifierRemovedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserIdentifierRemovedEvent.cs @@ -16,11 +16,9 @@ public record UserIdentifierRemovedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The key of the custom identifier. - public UserIdentifierRemovedEvent(ActorId actorId, string key) + public UserIdentifierRemovedEvent(string key) { - ActorId = actorId; Key = key; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserPasswordChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserPasswordChangedEvent.cs index 141d309..54a4dff 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserPasswordChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserPasswordChangedEvent.cs @@ -1,5 +1,4 @@ -using Logitar.EventSourcing; -using Logitar.Identity.Domain.Passwords; +using Logitar.Identity.Domain.Passwords; using MediatR; namespace Logitar.Identity.Domain.Users.Events; @@ -12,9 +11,8 @@ public record UserPasswordChangedEvent : UserPasswordEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier, generally the user's identifier. /// The new password of the user. - public UserPasswordChangedEvent(ActorId actorId, Password password) : base(actorId, password) + public UserPasswordChangedEvent(Password password) : base(password) { } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserPasswordEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserPasswordEvent.cs index 45a141e..66b5a5c 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserPasswordEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserPasswordEvent.cs @@ -16,11 +16,9 @@ public abstract record UserPasswordEvent : DomainEvent /// /// Initializes a new instance of the class. /// - /// The actor identifier, generally the user's identifier. /// The new password of the user. - protected UserPasswordEvent(ActorId actorId, Password password) + protected UserPasswordEvent(Password password) { - ActorId = actorId; Password = password; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserPasswordResetEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserPasswordResetEvent.cs index 596862e..59c99eb 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserPasswordResetEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserPasswordResetEvent.cs @@ -1,5 +1,4 @@ -using Logitar.EventSourcing; -using Logitar.Identity.Domain.Passwords; +using Logitar.Identity.Domain.Passwords; using MediatR; namespace Logitar.Identity.Domain.Users.Events; @@ -12,9 +11,8 @@ public record UserPasswordResetEvent : UserPasswordEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier, generally the user's identifier. /// The new password of the user. - public UserPasswordResetEvent(ActorId actorId, Password password) : base(actorId, password) + public UserPasswordResetEvent(Password password) : base(password) { } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserPasswordUpdatedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserPasswordUpdatedEvent.cs index a3390a0..e8c850a 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserPasswordUpdatedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserPasswordUpdatedEvent.cs @@ -1,5 +1,4 @@ -using Logitar.EventSourcing; -using Logitar.Identity.Domain.Passwords; +using Logitar.Identity.Domain.Passwords; using MediatR; namespace Logitar.Identity.Domain.Users.Events; @@ -12,9 +11,8 @@ public record UserPasswordUpdatedEvent : UserPasswordEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The new password of the user. - public UserPasswordUpdatedEvent(ActorId actorId, Password password) : base(actorId, password) + public UserPasswordUpdatedEvent(Password password) : base(password) { } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserPhoneChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserPhoneChangedEvent.cs index 8c8ec59..cb6c3b7 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserPhoneChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserPhoneChangedEvent.cs @@ -16,11 +16,9 @@ public record UserPhoneChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The new phone number of the user. - public UserPhoneChangedEvent(ActorId actorId, PhoneUnit? phone) + public UserPhoneChangedEvent(PhoneUnit? phone) { - ActorId = actorId; Phone = phone; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserRoleAddedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserRoleAddedEvent.cs index 58f4127..c472b69 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserRoleAddedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserRoleAddedEvent.cs @@ -17,11 +17,9 @@ public record UserRoleAddedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The role identifier. - public UserRoleAddedEvent(ActorId actorId, RoleId roleId) + public UserRoleAddedEvent(RoleId roleId) { - ActorId = actorId; RoleId = roleId; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserRoleRemovedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserRoleRemovedEvent.cs index b5e7d18..dce4f4b 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserRoleRemovedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserRoleRemovedEvent.cs @@ -17,11 +17,9 @@ public record UserRoleRemovedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The role identifier. - public UserRoleRemovedEvent(ActorId actorId, RoleId roleId) + public UserRoleRemovedEvent(RoleId roleId) { - ActorId = actorId; RoleId = roleId; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserSignedInEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserSignedInEvent.cs index 1b9981c..ac60ef1 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserSignedInEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserSignedInEvent.cs @@ -11,11 +11,9 @@ public record UserSignedInEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The date and time when the authentication occurred. - public UserSignedInEvent(ActorId actorId, DateTime occurredOn) + public UserSignedInEvent(DateTime occurredOn) { - ActorId = actorId; OccurredOn = occurredOn; } } diff --git a/src/Logitar.Identity.Domain/Users/Events/UserUniqueNameChangedEvent.cs b/src/Logitar.Identity.Domain/Users/Events/UserUniqueNameChangedEvent.cs index 8fc9c72..1b06a00 100644 --- a/src/Logitar.Identity.Domain/Users/Events/UserUniqueNameChangedEvent.cs +++ b/src/Logitar.Identity.Domain/Users/Events/UserUniqueNameChangedEvent.cs @@ -17,11 +17,9 @@ public record UserUniqueNameChangedEvent : DomainEvent, INotification /// /// Initializes a new instance of the class. /// - /// The actor identifier. /// The unique name of the user. - public UserUniqueNameChangedEvent(ActorId actorId, UniqueNameUnit uniqueName) + public UserUniqueNameChangedEvent(UniqueNameUnit uniqueName) { - ActorId = actorId; UniqueName = uniqueName; } } diff --git a/src/Logitar.Identity.Domain/Users/UserAggregate.cs b/src/Logitar.Identity.Domain/Users/UserAggregate.cs index 4582c93..ea4deb7 100644 --- a/src/Logitar.Identity.Domain/Users/UserAggregate.cs +++ b/src/Logitar.Identity.Domain/Users/UserAggregate.cs @@ -308,7 +308,7 @@ public UserAggregate(AggregateId id) : base(id) public UserAggregate(UniqueNameUnit uniqueName, TenantId? tenantId = null, ActorId actorId = default, UserId? id = null) : base((id ?? UserId.NewId()).AggregateId) { - Raise(new UserCreatedEvent(actorId, tenantId, uniqueName)); + Raise(new UserCreatedEvent(tenantId, uniqueName), actorId); } /// /// Applies the specified event. @@ -336,7 +336,7 @@ public void AddRole(RoleAggregate role, ActorId actorId = default) if (!HasRole(role)) { - Raise(new UserRoleAddedEvent(actorId, role.Id)); + Raise(new UserRoleAddedEvent(role.Id), actorId); } } /// @@ -372,7 +372,7 @@ public void Authenticate(string password, ActorId? actorId = null) } actorId ??= new(Id.Value); - Raise(new UserAuthenticatedEvent(actorId.Value)); + Raise(new UserAuthenticatedEvent(), actorId.Value); } /// /// Applies the specified event. @@ -408,7 +408,7 @@ public void ChangePassword(string currentPassword, Password newPassword, ActorId } actorId ??= new(Id.Value); - Raise(new UserPasswordChangedEvent(actorId.Value, newPassword)); + Raise(new UserPasswordChangedEvent(newPassword), actorId.Value); } /// /// Applies the specified event. @@ -427,7 +427,7 @@ public void Delete(ActorId actorId = default) { if (!IsDeleted) { - Raise(new UserDeletedEvent(actorId)); + Raise(new UserDeletedEvent(), actorId); } } @@ -439,7 +439,7 @@ public void Disable(ActorId actorId = default) { if (!IsDisabled) { - Raise(new UserDisabledEvent(actorId)); + Raise(new UserDisabledEvent(), actorId); } } /// @@ -459,7 +459,7 @@ public void Enable(ActorId actorId = default) { if (IsDisabled) { - Raise(new UserEnabledEvent(actorId)); + Raise(new UserEnabledEvent(), actorId); } } /// @@ -510,7 +510,7 @@ public void RemoveCustomIdentifier(string key, ActorId actorId = default) if (_customIdentifiers.ContainsKey(key)) { - Raise(new UserIdentifierRemovedEvent(actorId, key)); + Raise(new UserIdentifierRemovedEvent(key), actorId); } } /// @@ -531,7 +531,7 @@ public void RemoveRole(RoleAggregate role, ActorId actorId = default) { if (HasRole(role)) { - Raise(new UserRoleRemovedEvent(actorId, role.Id)); + Raise(new UserRoleRemovedEvent(role.Id), actorId); } } /// @@ -557,7 +557,7 @@ public void ResetPassword(Password password, ActorId? actorId = null) } actorId ??= new(Id.Value); - Raise(new UserPasswordResetEvent(actorId.Value, password)); + Raise(new UserPasswordResetEvent(password), actorId.Value); } /// /// Applies the specified event. @@ -577,7 +577,7 @@ public void SetAddress(AddressUnit? address, ActorId actorId = default) { if (address != Address) { - Raise(new UserAddressChangedEvent(actorId, address)); + Raise(new UserAddressChangedEvent(address), actorId); } } /// @@ -623,7 +623,7 @@ public void SetCustomIdentifier(string key, string value, ActorId actorId = defa if (!_customIdentifiers.TryGetValue(key, out string? existingValue) || existingValue != value) { - Raise(new UserIdentifierChangedEvent(actorId, key, value)); + Raise(new UserIdentifierChangedEvent(key, value), actorId); } } /// @@ -644,7 +644,7 @@ public void SetEmail(EmailUnit? email, ActorId actorId = default) { if (email != Email) { - Raise(new UserEmailChangedEvent(actorId, email)); + Raise(new UserEmailChangedEvent(email), actorId); } } /// @@ -663,7 +663,7 @@ protected virtual void Apply(UserEmailChangedEvent @event) /// The actor identifier. public void SetPassword(Password password, ActorId actorId = default) { - Raise(new UserPasswordUpdatedEvent(actorId, password)); + Raise(new UserPasswordUpdatedEvent(password), actorId); } /// /// Applies the specified event. @@ -683,7 +683,7 @@ public void SetPhone(PhoneUnit? phone, ActorId actorId = default) { if (phone != Phone) { - Raise(new UserPhoneChangedEvent(actorId, phone)); + Raise(new UserPhoneChangedEvent(phone), actorId); } } /// @@ -704,7 +704,7 @@ public void SetUniqueName(UniqueNameUnit uniqueName, ActorId actorId = default) { if (uniqueName != _uniqueName) { - Raise(new UserUniqueNameChangedEvent(actorId, uniqueName)); + Raise(new UserUniqueNameChangedEvent(uniqueName), actorId); } } /// @@ -759,7 +759,7 @@ public SessionAggregate SignIn(string? password, Password? secret = null, ActorI actorId ??= new(Id.Value); SessionAggregate session = new(this, secret, actorId, sessionId); - Raise(new UserSignedInEvent(actorId.Value, session.CreatedOn)); + Raise(new UserSignedInEvent(session.CreatedOn), actorId.Value); return session; } @@ -780,8 +780,7 @@ public void Update(ActorId actorId = default) { if (_updatedEvent.HasChanges) { - _updatedEvent.ActorId = actorId; - Raise(_updatedEvent); + Raise(_updatedEvent, actorId, DateTime.Now); _updatedEvent = new(); } } diff --git a/src/Logitar.Identity.EntityFrameworkCore.PostgreSQL/Logitar.Identity.EntityFrameworkCore.PostgreSQL.csproj b/src/Logitar.Identity.EntityFrameworkCore.PostgreSQL/Logitar.Identity.EntityFrameworkCore.PostgreSQL.csproj index 9536436..4f6c65a 100644 --- a/src/Logitar.Identity.EntityFrameworkCore.PostgreSQL/Logitar.Identity.EntityFrameworkCore.PostgreSQL.csproj +++ b/src/Logitar.Identity.EntityFrameworkCore.PostgreSQL/Logitar.Identity.EntityFrameworkCore.PostgreSQL.csproj @@ -52,7 +52,7 @@ - + diff --git a/src/Logitar.Identity.EntityFrameworkCore.Relational/EventDb.cs b/src/Logitar.Identity.EntityFrameworkCore.Relational/EventDb.cs deleted file mode 100644 index 9820ff3..0000000 --- a/src/Logitar.Identity.EntityFrameworkCore.Relational/EventDb.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Logitar.Data; -using Logitar.EventSourcing.EntityFrameworkCore.Relational; - -namespace Logitar.Identity.EntityFrameworkCore.Relational; - -public static class EventDb -{ - public static class Events - { - public static readonly TableId Table = new(nameof(EventContext.Events)); - - public static readonly ColumnId ActorId = new(nameof(EventEntity.ActorId), Table); - public static readonly ColumnId AggregateId = new(nameof(EventEntity.AggregateId), Table); - public static readonly ColumnId AggregateType = new(nameof(EventEntity.AggregateType), Table); - public static readonly ColumnId EvenEventTypetId = new(nameof(EventEntity.EventType), Table); - public static readonly ColumnId EventData = new(nameof(EventEntity.EventData), Table); - public static readonly ColumnId EventId = new(nameof(EventEntity.EventId), Table); - public static readonly ColumnId Id = new(nameof(EventEntity.Id), Table); - public static readonly ColumnId IsDeleted = new(nameof(EventEntity.IsDeleted), Table); - public static readonly ColumnId OccurredOn = new(nameof(EventEntity.OccurredOn), Table); - public static readonly ColumnId Version = new(nameof(EventEntity.Version), Table); - } -} diff --git a/src/Logitar.Identity.EntityFrameworkCore.Relational/Logitar.Identity.EntityFrameworkCore.Relational.csproj b/src/Logitar.Identity.EntityFrameworkCore.Relational/Logitar.Identity.EntityFrameworkCore.Relational.csproj index 0133c39..27495f9 100644 --- a/src/Logitar.Identity.EntityFrameworkCore.Relational/Logitar.Identity.EntityFrameworkCore.Relational.csproj +++ b/src/Logitar.Identity.EntityFrameworkCore.Relational/Logitar.Identity.EntityFrameworkCore.Relational.csproj @@ -52,7 +52,7 @@ - + diff --git a/src/Logitar.Identity.EntityFrameworkCore.SqlServer/Logitar.Identity.EntityFrameworkCore.SqlServer.csproj b/src/Logitar.Identity.EntityFrameworkCore.SqlServer/Logitar.Identity.EntityFrameworkCore.SqlServer.csproj index 51daf6c..7103714 100644 --- a/src/Logitar.Identity.EntityFrameworkCore.SqlServer/Logitar.Identity.EntityFrameworkCore.SqlServer.csproj +++ b/src/Logitar.Identity.EntityFrameworkCore.SqlServer/Logitar.Identity.EntityFrameworkCore.SqlServer.csproj @@ -52,7 +52,7 @@ - + diff --git a/src/Logitar.Identity.Infrastructure/Logitar.Identity.Infrastructure.csproj b/src/Logitar.Identity.Infrastructure/Logitar.Identity.Infrastructure.csproj index a7216c9..785b0e8 100644 --- a/src/Logitar.Identity.Infrastructure/Logitar.Identity.Infrastructure.csproj +++ b/src/Logitar.Identity.Infrastructure/Logitar.Identity.Infrastructure.csproj @@ -51,10 +51,10 @@ - + - - + + diff --git a/tests/Logitar.Identity.Domain.UnitTests/Logitar.Identity.Domain.UnitTests.csproj b/tests/Logitar.Identity.Domain.UnitTests/Logitar.Identity.Domain.UnitTests.csproj index 3859ecc..89ba26b 100644 --- a/tests/Logitar.Identity.Domain.UnitTests/Logitar.Identity.Domain.UnitTests.csproj +++ b/tests/Logitar.Identity.Domain.UnitTests/Logitar.Identity.Domain.UnitTests.csproj @@ -13,13 +13,13 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests.csproj b/tests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests.csproj index 5eace0b..74ade17 100644 --- a/tests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests.csproj +++ b/tests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests/Logitar.Identity.EFCore.PostgreSQL.IntegrationTests.csproj @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Logitar.Identity.EFCore.Relational.IntegrationTests.csproj b/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Logitar.Identity.EFCore.Relational.IntegrationTests.csproj index ac98a11..f987eee 100644 --- a/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Logitar.Identity.EFCore.Relational.IntegrationTests.csproj +++ b/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Logitar.Identity.EFCore.Relational.IntegrationTests.csproj @@ -19,7 +19,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Repositories/SessionRepositoryTestsBase.cs b/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Repositories/SessionRepositoryTestsBase.cs index 1c8df7d..3339dc2 100644 --- a/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Repositories/SessionRepositoryTestsBase.cs +++ b/tests/Logitar.Identity.EFCore.Relational.IntegrationTests/Repositories/SessionRepositoryTestsBase.cs @@ -1,5 +1,6 @@ using Logitar.Data; using Logitar.EventSourcing; +using Logitar.EventSourcing.EntityFrameworkCore.Relational; using Logitar.Identity.Contracts.Settings; using Logitar.Identity.Domain.Sessions; using Logitar.Identity.Domain.Settings; diff --git a/tests/Logitar.Identity.EFCore.SqlServer.IntegrationTests/Logitar.Identity.EFCore.SqlServer.IntegrationTests.csproj b/tests/Logitar.Identity.EFCore.SqlServer.IntegrationTests/Logitar.Identity.EFCore.SqlServer.IntegrationTests.csproj index 497e46b..466d0b7 100644 --- a/tests/Logitar.Identity.EFCore.SqlServer.IntegrationTests/Logitar.Identity.EFCore.SqlServer.IntegrationTests.csproj +++ b/tests/Logitar.Identity.EFCore.SqlServer.IntegrationTests/Logitar.Identity.EFCore.SqlServer.IntegrationTests.csproj @@ -29,7 +29,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Logitar.Identity.Infrastructure.UnitTests/Logitar.Identity.Infrastructure.UnitTests.csproj b/tests/Logitar.Identity.Infrastructure.UnitTests/Logitar.Identity.Infrastructure.UnitTests.csproj index 0939e76..58e00d9 100644 --- a/tests/Logitar.Identity.Infrastructure.UnitTests/Logitar.Identity.Infrastructure.UnitTests.csproj +++ b/tests/Logitar.Identity.Infrastructure.UnitTests/Logitar.Identity.Infrastructure.UnitTests.csproj @@ -25,7 +25,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Logitar.Identity.Tests/Logitar.Identity.Tests.csproj b/tests/Logitar.Identity.Tests/Logitar.Identity.Tests.csproj index 0feb3be..5306c62 100644 --- a/tests/Logitar.Identity.Tests/Logitar.Identity.Tests.csproj +++ b/tests/Logitar.Identity.Tests/Logitar.Identity.Tests.csproj @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all