Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time

CommandQuery.Client

Clients for CommandQuery

Installation

NuGet CommandQuery.Client
Package Manager PM> Install-Package CommandQuery.Client -Version 1.0.0
.NET CLI > dotnet add package CommandQuery.Client --version 1.0.0
PackageReference <PackageReference Include="CommandQuery.Client" Version="1.0.0" />
Paket CLI > paket add CommandQuery.Client --version 1.0.0

Sample Code

CommandQuery.Sample.Client

Commands

Create a CommandClient and invoke Post:

var commandClient = new CommandClient("https://commandquery-sample-azurefunctions-vs2.azurewebsites.net/api/command/");

commandClient.Post(new FooCommand { Value = "sv-SE" });
await commandClient.PostAsync(new FooCommand { Value = "en-GB" });

Commands with result:

var result = commandClient.Post(new BazCommand { Value = "sv-SE" });
result = await commandClient.PostAsync(new BazCommand { Value = "en-GB" });

Queries

Create a QueryClient and invoke Post or Get:

var queryClient = new QueryClient("https://commandquery-sample-azurefunctions-vs2.azurewebsites.net/api/query/");

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

result = queryClient.Get(new BarQuery { Id = 1 });
result = await queryClient.GetAsync(new BarQuery { Id = 1 });