This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
115 changed files
with
1,043 additions
and
1,788 deletions.
There are no files selected for viewing
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
22 changes: 9 additions & 13 deletions
22
samples/Kledex.Sample.EventSourcing/Domain/Commands/Handlers/CreateProductHandler.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 |
---|---|---|
@@ -1,23 +1,19 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Kledex.Domain; | ||
using System.Threading.Tasks; | ||
using Kledex.Commands; | ||
|
||
namespace Kledex.Sample.EventSourcing.Domain.Commands.Handlers | ||
{ | ||
public class CreateProductHandler : IDomainCommandHandlerAsync<CreateProduct> | ||
public class CreateProductHandler : ICommandHandlerAsync<CreateProduct> | ||
{ | ||
private readonly IRepository<Product> _repository; | ||
|
||
public CreateProductHandler(IRepository<Product> repository) | ||
{ | ||
_repository = repository; | ||
} | ||
|
||
public async Task<IEnumerable<IDomainEvent>> HandleAsync(CreateProduct command) | ||
public async Task<CommandResponse> HandleAsync(CreateProduct command) | ||
{ | ||
var product = new Product(command.AggregateRootId, command.Name, command.Description, command.Price); | ||
|
||
return await Task.FromResult(product.Events); | ||
return await Task.FromResult(new CommandResponse | ||
{ | ||
Events = product.Events, | ||
Result = true | ||
}); | ||
} | ||
} | ||
} |
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
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
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
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,8 @@ | ||
using Kledex.Events; | ||
|
||
namespace Kledex.Sample.EventSourcing.Services | ||
{ | ||
public class EmailSent : Event | ||
{ | ||
} | ||
} |
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,8 @@ | ||
using Kledex.Commands; | ||
|
||
namespace Kledex.Sample.EventSourcing.Services | ||
{ | ||
public class SendEmail : Command | ||
{ | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
samples/Kledex.Sample.EventSourcing/Services/SendEmailHandler.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,21 @@ | ||
using Kledex.Commands; | ||
using Kledex.Events; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kledex.Sample.EventSourcing.Services | ||
{ | ||
public class SendEmailHandler : ICommandHandlerAsync<SendEmail> | ||
{ | ||
public Task<CommandResponse> HandleAsync(SendEmail command) | ||
{ | ||
return Task.FromResult(new CommandResponse | ||
{ | ||
Events = new List<IEvent>() | ||
{ | ||
new EmailSent() | ||
} | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.