Skip to content

Commit

Permalink
Updated packages
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed May 14, 2022
1 parent bc9b27c commit bb6c3fe
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 99 deletions.
7 changes: 0 additions & 7 deletions EventSourcing.NetCore.sln
Expand Up @@ -323,8 +323,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13-Projections.SingleStream
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "14-Projections.SingleStream.EventualConsistency", "Workshops\IntroductionToEventSourcing\Solved\14-Projections.SingleStream.EventualConsistency\14-Projections.SingleStream.EventualConsistency.csproj", "{A5A2A4CB-08F6-49AE-B044-DD9C5F8B0F48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventPipelines.EventStoreDB", "Sample\EventPipelines\EventPipelines.EventStoreDB\EventPipelines.EventStoreDB.csproj", "{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Warehouse.MinimalAPI", "Warehouse.MinimalAPI", "{005FC7CE-97BA-47F7-982E-63C46327F78C}"
ProjectSection(SolutionItems) = preProject
Sample\Warehouse.MinimalAPI\docker-compose.yml = Sample\Warehouse.MinimalAPI\docker-compose.yml
Expand Down Expand Up @@ -747,10 +745,6 @@ Global
{A5A2A4CB-08F6-49AE-B044-DD9C5F8B0F48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5A2A4CB-08F6-49AE-B044-DD9C5F8B0F48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5A2A4CB-08F6-49AE-B044-DD9C5F8B0F48}.Release|Any CPU.Build.0 = Release|Any CPU
{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0}.Release|Any CPU.Build.0 = Release|Any CPU
{723AD8CE-E3EF-40F6-9576-CCF2C3DB504E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{723AD8CE-E3EF-40F6-9576-CCF2C3DB504E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{723AD8CE-E3EF-40F6-9576-CCF2C3DB504E}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -885,7 +879,6 @@ Global
{2CA4B0B3-AF8B-4BD8-A18D-18EE1F93DE04} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
{7A990FD1-4935-4F85-912C-D4B870232856} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
{A5A2A4CB-08F6-49AE-B044-DD9C5F8B0F48} = {65F6E2BE-B2D4-4E56-B0CB-3062C4882B9E}
{9B7FBEE7-99AE-4A94-8E36-FBE1A62BEEE0} = {D9799DB3-9D11-4909-8133-64CD96F6E1AC}
{005FC7CE-97BA-47F7-982E-63C46327F78C} = {A7186B6B-D56D-4AEF-B6B7-FAA827764C34}
{723AD8CE-E3EF-40F6-9576-CCF2C3DB504E} = {005FC7CE-97BA-47F7-982E-63C46327F78C}
EndGlobalSection
Expand Down
33 changes: 22 additions & 11 deletions README.md
Expand Up @@ -30,11 +30,12 @@ Tutorial, practical samples and other resources about Event Sourcing in .NET. Se
- [6.2 Simple EventSourcing with EventStoreDB](#62-simple-eventsourcing-with-eventstoredb)
- [6.3 ECommerce with EventStoreDB](#63-ecommerce-with-eventstoredb)
- [6.5 Warehouse](#65-warehouse)
- [6.6 Event Versioning](#66-event-versioning)
- [6.7 Event Pipelines](#67-event-pipelines)
- [6.8 Meetings Management with Marten](#68-meetings-management-with-marten)
- [6.9 Cinema Tickets Reservations with Marten](#69-cinema-tickets-reservations-with-marten)
- [6.10 SmartHome IoT with Marten](#610-smarthome-iot-with-marten)
- [6.6 Warehouse Minimal API](#66-warehouse-minimal-api)
- [6.7 Event Versioning](#67-event-versioning)
- [6.8 Event Pipelines](#68-event-pipelines)
- [6.9 Meetings Management with Marten](#69-meetings-management-with-marten)
- [6.10 Cinema Tickets Reservations with Marten](#610-cinema-tickets-reservations-with-marten)
- [6.11 SmartHome IoT with Marten](#611-smarthome-iot-with-marten)
- [7. Self-paced training Kits](#7-self-paced-training-kits)
- [7.1 Introduction to Event Sourcing](#71-introduction-to-event-sourcing)
- [7.2 Build your own Event Store](#72-build-your-own-event-store)
Expand Down Expand Up @@ -652,7 +653,13 @@ Samples are using CQRS architecture. They're sliced based on the business module
- No Event Sourcing! Using Entity Framework to show that CQRS is not bounded to Event Sourcing or any type of storage,
- No Aggregates! CQRS do not need DDD. Business logic can be handled in handlers.

### 6.6 [Event Versioning](./Sample/EventsVersioning)
### 6.6 [Warehouse Minimal API](./Sample/Warehouse.MinimalAPI/)
Variation of the previous example, but:
- using Minimal API,
- example how to inject handlers in MediatR like style to decouple API from handlers.
- 📝 Read more [CQRS is simpler than you think with .NET 6 and C# 10](https://event-driven.io/en/cqrs_is_simpler_than_you_think_with_net6/?utm_source=event_sourcing_net)

### 6.7 [Event Versioning](./Sample/EventsVersioning)
Shows how to handle basic event schema versioning scenarios using event and stream transformations (e.g. upcasting):
- [Simple mapping](./Sample/EventsVersioning/#simple-mapping)
- [New not required property](./Sample/EventsVersioning/#new-not-required-property)
Expand All @@ -665,8 +672,9 @@ Shows how to handle basic event schema versioning scenarios using event and stre
- [Events Transformations](./Sample/EventsVersioning/#events-transformations)
- [Stream Transformation](./Sample/EventsVersioning/#stream-transformation)
- [Summary](./Sample/EventsVersioning/#summary)
- 📝 [Simple patterns for events schema versioning](https://event-driven.io/en/simple_events_versioning_patterns/?utm_source=event_sourcing_net)

### 6.7 [Event Pipelines](./Sample/EventPipelines)
### 6.8 [Event Pipelines](./Sample/EventPipelines)
Shows how to compose event handlers in the processing pipelines to:
- filter events,
- transform them,
Expand All @@ -676,21 +684,22 @@ Shows how to compose event handlers in the processing pipelines to:
- allows using interfaces and classes if you want to,
- can be used with Dependency Injection, but also without through builder,
- integrates with MediatR if you want to.
- 📝 Read more [How to build a simple event pipeline](https://event-driven.io/en/how_to_build_simple_event_pipeline/?utm_source=event_sourcing_net)

### 6.8 [Meetings Management with Marten](./Sample/MeetingsManagement/)
### 6.9 [Meetings Management with Marten](./Sample/MeetingsManagement/)
- typical Event Sourcing and CQRS flow,
- DDD using Aggregates,
- microservices example,
- stores events to Marten,
- Kafka as a messaging platform to integrate microservices,
- read models handled in separate microservice and stored to other database (ElasticSearch)

### 6.9 [Cinema Tickets Reservations with Marten](./Sample/Tickets/)
### 6.10 [Cinema Tickets Reservations with Marten](./Sample/Tickets/)
- typical Event Sourcing and CQRS flow,
- DDD using Aggregates,
- stores events to Marten.

### 6.10 [SmartHome IoT with Marten](./Sample/AsyncProjections/)
### 6.11 [SmartHome IoT with Marten](./Sample/AsyncProjections/)
- typical Event Sourcing and CQRS flow,
- DDD using Aggregates,
- stores events to Marten,
Expand Down Expand Up @@ -762,6 +771,7 @@ Read also more on the **Event Sourcing** and **CQRS** topics in my [blog](https:
- 📝 [How to slice the codebase effectively?](https://event-driven.io/en/how_to_slice_the_codebase_effectively/?utm_source=event_sourcing_net)
- 📝 [Generic does not mean Simple?](https://event-driven.io/en/generic_does_not_mean_simple/?utm_source=event_sourcing_net)
- 📝 [Can command return a value?](https://event-driven.io/en/can_command_return_a_value/?utm_source=event_sourcing_net)
- 📝 [CQRS is simpler than you think with .NET 6 and C# 10](https://event-driven.io/en/cqrs_is_simpler_than_you_think_with_net6/?utm_source=event_sourcing_net)
- 📝 [How to register all CQRS handlers by convention](https://event-driven.io/en/how_to_register_all_mediatr_handlers_by_convention/?utm_source=event_sourcing_net)
- 📝 [How to use ETag header for optimistic concurrency](https://event-driven.io/en/how_to_use_etag_header_for_optimistic_concurrency/?utm_source=event_sourcing_net)
- 📝 [Dealing with Eventual Consistency and Idempotency in MongoDB projections](https://event-driven.io/en/dealing_with_eventual_consistency_and_idempotency_in_mongodb_projections/?utm_source=event_sourcing_net)
Expand All @@ -770,7 +780,8 @@ Read also more on the **Event Sourcing** and **CQRS** topics in my [blog](https:
- 📝 [How to do snapshots in Marten?](https://event-driven.io/en/how_to_do_snapshots_in_Marten/?utm_source=event_sourcing_net)
- 📝 [Integrating Marten with other systems](https://event-driven.io/en/integrating_Marten/?utm_source=event_sourcing_net)
- 📝 [How to (not) do the events versioning?](https://event-driven.io/en/how_to_do_event_versioning/?utm_source=event_sourcing_net)
- 📝 [Simple patterns for events schema versioning](https://event-driven.io/en/simple_events_versioning_patterns/?utm_source=event_sourcing_net)
- 📝 [Simple patterns for events schema versioning](https://event-driven.io/en/simple_events_versioning_patterns/?utm_source=event_sourcing_net)
- 📝 [How to build a simple event pipeline](https://event-driven.io/en/how_to_build_simple_event_pipeline/?utm_source=event_sourcing_net)
- 📝 [How to create projections of events for nested object structures?](https://event-driven.io/en/how_to_create_projections_of_events_for_nested_object_structures/?utm_source=event_sourcing_net)
- 📝 [How to scale projections in the event-driven systems?](https://event-driven.io/en/how_to_scale_projections_in_the_event_driven_systems/?utm_source=event_sourcing_net)
- 📝 [Immutable Value Objects are simpler and more useful than you think!](https://event-driven.io/en/immutable_value_objects/?utm_source=event_sourcing_net)
Expand Down

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions Sample/EventPipelines/README.md
Expand Up @@ -9,6 +9,7 @@ Shows how to compose event handlers in the processing pipelines to:
- allows using interfaces and classes if you want to,
- can be used with Dependency Injection, but also without through builder,
- integrates with MediatR if you want to.
- 📝 Read more [How to build a simple event pipeline](https://event-driven.io/en/how_to_build_simple_event_pipeline/?utm_source=event_sourcing_net)

## Overview

Expand Down
8 changes: 5 additions & 3 deletions Sample/Warehouse.MinimalAPI/README.md
@@ -1,5 +1,7 @@
# Warehouse
- simplest CQRS flow using .NET 5 Endpoints,
# Warehouse Minimal API
- CQRS flow using Minimal API,
- example how to inject handlers in MediatR like style to decouple API from handling,
- example of how and where to use C# Records, Nullable Reference Types, etc,
- No Event Sourcing! Using Entity Framework to show that CQRS is not bounded to Event Sourcing or any type of storage,
- No Aggregates! CQRS do not need DDD. Business logic can be handled in handlers.
- No Aggregates! CQRS do not need DDD. Business logic can be handled in handlers.
- 📝 Read more [CQRS is simpler than you think with .NET 6 and C# 10](https://event-driven.io/en/cqrs_is_simpler_than_you_think_with_net6/?utm_source=event_sourcing_net)
80 changes: 41 additions & 39 deletions Sample/Warehouse.MinimalAPI/Warehouse.Api/Program.cs
Expand Up @@ -31,61 +31,63 @@
}

// Get Products
app.MapGet("/api/products", HandleGetProducts)
app.MapGet(
"/api/products",
(
[FromServices] QueryHandler<GetProducts, IReadOnlyList<ProductListItem>> getProducts,
string? filter,
int? page,
int? pageSize,
CancellationToken ct
) =>
getProducts(GetProducts.With(filter, page, pageSize), ct)
)
.Produces((int)HttpStatusCode.BadRequest);

ValueTask<IReadOnlyList<ProductListItem>> HandleGetProducts(
[FromServices] QueryHandler<GetProducts, IReadOnlyList<ProductListItem>> getProducts,
string? filter,
int? page,
int? pageSize,
CancellationToken ct
) =>
getProducts(GetProducts.With(filter, page, pageSize), ct);


// Get Product Details by Id
app.MapGet("/api/products/{id}", HandleGetProductDetails)
app.MapGet(
"/api/products/{id:guid}",
async (
[FromServices] QueryHandler<GetProductDetails, ProductDetails?> getProductById,
Guid id,
CancellationToken ct
) =>
await getProductById(GetProductDetails.With(id), ct)
is { } product
? Results.Ok(product)
: Results.NotFound()
)
.Produces(StatusCodes.Status400BadRequest)
.Produces(StatusCodes.Status404NotFound);

async Task<IResult> HandleGetProductDetails(
[FromServices] QueryHandler<GetProductDetails, ProductDetails?> getProductById,
Guid productId,
CancellationToken ct
) =>
await getProductById(GetProductDetails.With(productId), ct)
is { } product
? Results.Ok(product)
: Results.NotFound();

// Register new product
app.MapPost("api/products/",HandleRegisterProduct)
app.MapPost(
"api/products/",
async (
[FromServices] CommandHandler<RegisterProduct> registerProduct,
RegisterProductRequest request,
CancellationToken ct
) =>
{
var productId = Guid.NewGuid();
var (sku, name, description) = request;
await registerProduct(
RegisterProduct.With(productId, sku, name, description),
ct);
return Results.Created($"/api/products/{productId}", productId);
}
)
.Produces(StatusCodes.Status400BadRequest)
.Produces(StatusCodes.Status404NotFound);

async Task<IResult> HandleRegisterProduct(
[FromServices] CommandHandler<RegisterProduct> registerProduct,
RegisterProductRequest request,
CancellationToken ct
)
{
var productId = Guid.NewGuid();
var (sku, name, description) = request;

await registerProduct(
RegisterProduct.With(productId, sku, name, description),
ct);

return Results.Created($"/api/products/{productId}", productId);
}

app.Run();

public record RegisterProductRequest(
string? SKU,
string? Name,
string? Description
);

public partial class Program { }
12 changes: 6 additions & 6 deletions Sample/Warehouse.MinimalAPI/Warehouse.Api/Warehouse.Api.csproj
Expand Up @@ -7,15 +7,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.4" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.4" NoWarn="NU1605" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.4">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" NoWarn="NU1605" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.5" NoWarn="NU1605" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.5" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit bb6c3fe

Please sign in to comment.