-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(domain): add changeHistory and outboxMessage
- Loading branch information
1 parent
f85d17f
commit afc63a6
Showing
14 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Src/Product.Domain/Aggregates/Shared/ChangeHistory/AggregateRoot/ChangeHistory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Text.Json; | ||
using Product.Domain.Shared.Base; | ||
|
||
namespace Product.Domain.Aggregates.Shared.ChangeHistory.AggregateRoot; | ||
|
||
public class ChangeHistory : BaseEntity | ||
{ | ||
public string OldValue { get; private set; } | ||
Check warning on line 8 in Src/Product.Domain/Aggregates/Shared/ChangeHistory/AggregateRoot/ChangeHistory.cs GitHub Actions / build
|
||
public string NewValue { get;private set; } | ||
public string RelatedEntityId { get; private set; } | ||
public string RelatedEntityType { get; private set; } | ||
|
||
public void LogHistory(BaseEntity oldEntity , BaseEntity newEntity) | ||
{ | ||
OldValue = JsonSerializer.Serialize(oldEntity); | ||
NewValue = JsonSerializer.Serialize(oldEntity); | ||
RelatedEntityId = oldEntity.Id.ToString(); | ||
RelatedEntityType = oldEntity.GetType().Name; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Src/Product.Domain/Aggregates/Shared/OutboxMessage/AggregateRoot/OutBoxMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Text.Json; | ||
using Product.Domain.Shared.Base; | ||
using Product.Domain.Shared.Events; | ||
|
||
namespace Product.Domain.Aggregates.Shared.OutboxMessage.AggregateRoot; | ||
|
||
public class OutBoxMessage : BaseEntity | ||
{ | ||
public OutBoxMessage(string type , string content) | ||
{ | ||
Type = type; | ||
Content = content; | ||
} | ||
public OutBoxMessage(IDomainEvent domainEvent) | ||
{ | ||
Type = domainEvent.GetType().Name; | ||
Content = JsonSerializer.Serialize(domainEvent); | ||
} | ||
|
||
public string Type { get; private set; } | ||
public string Content { get; private set; } | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Src/Product.Domain/Shared/GenericRepository/Interfaces/Command/IRepository.Async.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Src/Product.Domain/Shared/GenericRepository/Interfaces/Command/IRepository.Sync.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Src/Product.Domain/Shared/GenericRepository/Interfaces/IUnitOfWork.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Src/Product.Infrastructure/Data/Repository/GenericRepository/Command/Repository.Async.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Src/Product.Infrastructure/Data/Repository/UnitOfWork/UnitOfWork.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters