Skip to content

Commit 56667ee

Browse files
committed
docs
1 parent da2dec9 commit 56667ee

10 files changed

+41
-50
lines changed

CommandQuery.AWSLambda.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,22 @@
2626

2727
![New Project - AWS Serverless Application (.NET Core - C#)](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-aws-serverless-application-1.png)
2828

29+
![New AWS Serverless Application - Empty Serverless Application](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-aws-serverless-application-2.png)
30+
2931
Choose:
3032

3133
* Empty Serverless Application
3234

33-
![New AWS Serverless Application - Empty Serverless Application](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-aws-serverless-application-2.png)
34-
3535
## Commands
3636

3737
```cs
38-
using Amazon.Lambda.Core;
3938
using Amazon.Lambda.APIGatewayEvents;
39+
using Amazon.Lambda.Core;
4040
using CommandQuery.AWSLambda;
4141
using CommandQuery.Sample.Contracts.Commands;
4242
using CommandQuery.Sample.Handlers;
4343
using CommandQuery.Sample.Handlers.Commands;
4444
using Microsoft.Extensions.DependencyInjection;
45-
using System.Text.Json;
4645

4746
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
4847

@@ -83,14 +82,13 @@ Commands with result:
8382
## Queries
8483

8584
```cs
86-
using Amazon.Lambda.Core;
8785
using Amazon.Lambda.APIGatewayEvents;
86+
using Amazon.Lambda.Core;
8887
using CommandQuery.AWSLambda;
8988
using CommandQuery.Sample.Contracts.Queries;
9089
using CommandQuery.Sample.Handlers;
9190
using CommandQuery.Sample.Handlers.Queries;
9291
using Microsoft.Extensions.DependencyInjection;
93-
using System.Text.Json;
9492

9593
namespace CommandQuery.Sample.AWSLambda
9694
{
@@ -137,6 +135,9 @@ Configuration in `serverless.template`:
137135
"Command": {
138136
"Type": "AWS::Serverless::Function",
139137
"Properties": {
138+
"Architectures": [
139+
"x86_64"
140+
],
140141
"Handler": "CommandQuery.Sample.AWSLambda::CommandQuery.Sample.AWSLambda.Command::Handle",
141142
"Runtime": "dotnet6",
142143
"CodeUri": "",
@@ -160,6 +161,9 @@ Configuration in `serverless.template`:
160161
"Query": {
161162
"Type": "AWS::Serverless::Function",
162163
"Properties": {
164+
"Architectures": [
165+
"x86_64"
166+
],
163167
"Handler": "CommandQuery.Sample.AWSLambda::CommandQuery.Sample.AWSLambda.Query::Handle",
164168
"Runtime": "dotnet6",
165169
"CodeUri": "",

CommandQuery.AspNetCore.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
Choose:
2626

27-
* .NET 6.0 (Long-term support)
27+
* .NET 6.0 (Long Term Support)
2828
* Use controllers (uncheck to use minimal APIs)
2929

3030
## Configuration
@@ -258,7 +258,5 @@ namespace CommandQuery.Sample.AspNetCore.V6.Tests
258258

259259
## Samples
260260

261-
* [CommandQuery.Sample.AspNetCore.V3](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AspNetCore.V3)
262-
* [CommandQuery.Sample.AspNetCore.V3.Tests](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AspNetCore.V3.Tests)
263261
* [CommandQuery.Sample.AspNetCore.V6](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AspNetCore.V6)
264262
* [CommandQuery.Sample.AspNetCore.V6.Tests](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AspNetCore.V6.Tests)

CommandQuery.AzureFunctions.md

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
0. Install **Azure development** workload in Visual Studio
1313
* [Prerequisites](https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs?tabs=in-process#prerequisites)
14-
1. Create a new **Azure Functions** project
15-
* [Tutorial](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio)
14+
1. Create a new **Azure Functions** (_isolated worker process_) project
15+
* [Tutorial](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide)
1616
2. Install the `CommandQuery.AzureFunctions` package from [NuGet](https://www.nuget.org/packages/CommandQuery.AzureFunctions/)
1717
* `PM>` `Install-Package CommandQuery.AzureFunctions`
1818
3. Create functions
@@ -26,17 +26,16 @@
2626

2727
![Add a new project - Azure Functions](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-azure-functions-1.png)
2828

29+
![Create a new Azure Functions Application](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-azure-functions-2.png)
30+
2931
Choose:
3032

31-
* .NET 6 Isolated
33+
* .NET 6.0 Isolated (Long Term Support)
3234
* Http trigger
3335

34-
![Create a new Azure Functions Application](https://github.com/hlaueriksson/CommandQuery/raw/master/vs-new-project-azure-functions-2.png)
35-
3636
## Commands
3737

3838
```cs
39-
using System.Threading.Tasks;
4039
using CommandQuery.AzureFunctions;
4140
using Microsoft.Azure.Functions.Worker;
4241
using Microsoft.Azure.Functions.Worker.Http;
@@ -57,7 +56,7 @@ namespace CommandQuery.Sample.AzureFunctions.V6
5756

5857
[Function("Command")]
5958
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "command/{commandName}")] HttpRequestData req, FunctionContext executionContext, string commandName) =>
60-
await _commandFunction.HandleAsync(commandName, req, _logger);
59+
await _commandFunction.HandleAsync(commandName, req, _logger, executionContext.CancellationToken);
6160
}
6261
}
6362
```
@@ -75,7 +74,6 @@ Commands with result:
7574
## Queries
7675

7776
```cs
78-
using System.Threading.Tasks;
7977
using CommandQuery.AzureFunctions;
8078
using Microsoft.Azure.Functions.Worker;
8179
using Microsoft.Azure.Functions.Worker.Http;
@@ -96,7 +94,7 @@ namespace CommandQuery.Sample.AzureFunctions.V6
9694

9795
[Function("Query")]
9896
public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "query/{queryName}")] HttpRequestData req, FunctionContext executionContext, string queryName) =>
99-
await _queryFunction.HandleAsync(queryName, req, _logger);
97+
await _queryFunction.HandleAsync(queryName, req, _logger, executionContext.CancellationToken);
10098
}
10199
}
102100
```
@@ -113,7 +111,7 @@ namespace CommandQuery.Sample.AzureFunctions.V6
113111
Configuration in `Program.cs`:
114112

115113
```cs
116-
using System.Text.Json;
114+
using CommandQuery;
117115
using CommandQuery.AzureFunctions;
118116
using CommandQuery.Sample.Contracts.Commands;
119117
using CommandQuery.Sample.Contracts.Queries;
@@ -123,37 +121,31 @@ using CommandQuery.Sample.Handlers.Queries;
123121
using Microsoft.Extensions.DependencyInjection;
124122
using Microsoft.Extensions.Hosting;
125123

126-
namespace CommandQuery.Sample.AzureFunctions.V6
127-
{
128-
public class Program
129-
{
130-
public static void Main()
131-
{
132-
var host = new HostBuilder()
133-
.ConfigureFunctionsWorkerDefaults()
134-
.ConfigureServices(ConfigureServices)
135-
.Build();
124+
var host = new HostBuilder()
125+
.ConfigureFunctionsWorkerDefaults()
126+
.ConfigureServices(ConfigureServices)
127+
.Build();
136128

137-
// Validation
138-
host.Services.GetService<ICommandProcessor>().AssertConfigurationIsValid();
139-
host.Services.GetService<IQueryProcessor>().AssertConfigurationIsValid();
129+
// Validation
130+
host.Services.GetService<ICommandProcessor>()!.AssertConfigurationIsValid();
131+
host.Services.GetService<IQueryProcessor>()!.AssertConfigurationIsValid();
140132

141-
host.Run();
142-
}
133+
host.Run();
143134

144-
public static void ConfigureServices(IServiceCollection services)
145-
{
146-
services
147-
//.AddSingleton(new JsonSerializerOptions(JsonSerializerDefaults.Web));
135+
public static partial class Program
136+
{
137+
public static void ConfigureServices(IServiceCollection services)
138+
{
139+
services
140+
//.AddSingleton(new JsonSerializerOptions(JsonSerializerDefaults.Web));
148141
149-
// Add commands and queries
150-
.AddCommandFunction(typeof(FooCommandHandler).Assembly, typeof(FooCommand).Assembly)
151-
.AddQueryFunction(typeof(BarQueryHandler).Assembly, typeof(BarQuery).Assembly)
142+
// Add commands and queries
143+
.AddCommandFunction(typeof(FooCommandHandler).Assembly, typeof(FooCommand).Assembly)
144+
.AddQueryFunction(typeof(BarQueryHandler).Assembly, typeof(BarQuery).Assembly)
152145

153-
// Add handler dependencies
154-
.AddTransient<IDateTimeProxy, DateTimeProxy>()
155-
.AddTransient<ICultureService, CultureService>();
156-
}
146+
// Add handler dependencies
147+
.AddTransient<IDateTimeProxy, DateTimeProxy>()
148+
.AddTransient<ICultureService, CultureService>();
157149
}
158150
}
159151
```
@@ -302,7 +294,5 @@ namespace CommandQuery.Sample.AzureFunctions.V6.Tests
302294

303295
## Samples
304296

305-
* [CommandQuery.Sample.AzureFunctions.V3](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AzureFunctions.V3)
306-
* [CommandQuery.Sample.AzureFunctions.V3.Tests](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AzureFunctions.V3.Tests)
307297
* [CommandQuery.Sample.AzureFunctions.V6](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AzureFunctions.V6)
308298
* [CommandQuery.Sample.AzureFunctions.V6.Tests](https://github.com/hlaueriksson/CommandQuery/tree/master/samples/CommandQuery.Sample.AzureFunctions.V6.Tests)

CommandQuery.Client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Create a `CommandClient` and invoke `PostAsync`:
1010

1111
```cs
12-
var commandClient = new CommandClient("https://commandquery-sample-aspnetcore-v5.azurewebsites.net/api/command/");
12+
var commandClient = new CommandClient("https://commandquerysampleaspnetcorev6.azurewebsites.net/api/command/");
1313

1414
await commandClient.PostAsync(new FooCommand { Value = "en-GB" });
1515
```
@@ -25,7 +25,7 @@ var result = await commandClient.PostAsync(new BazCommand { Value = "en-GB" });
2525
Create a `QueryClient` and invoke `PostAsync` or `GetAsync`:
2626

2727
```cs
28-
var queryClient = new QueryClient("https://commandquery-sample-aspnetcore-v5.azurewebsites.net/api/query/");
28+
var queryClient = new QueryClient("https://commandquerysampleaspnetcorev6.azurewebsites.net/api/query/");
2929

3030
var result = await queryClient.PostAsync(new BarQuery { Id = 1 });
3131
result = await queryClient.GetAsync(new BarQuery { Id = 1 });

CommandQuery.GoogleCloudFunctions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ namespace CommandQuery.Sample.GoogleCloudFunctions
114114
Configuration in `Startup.cs`:
115115

116116
```cs
117-
using System.Text.Json;
118117
using CommandQuery.GoogleCloudFunctions;
119118
using CommandQuery.Sample.Contracts.Commands;
120119
using CommandQuery.Sample.Contracts.Queries;
493 Bytes
Loading
-3.61 KB
Loading
-584 Bytes
Loading

vs-new-project-azure-functions-1.png

-3.69 KB
Loading

vs-new-project-azure-functions-2.png

-541 Bytes
Loading

0 commit comments

Comments
 (0)