MQContract.CQRS
4.0.0
dotnet add package MQContract.CQRS --version 4.0.0
NuGet\Install-Package MQContract.CQRS -Version 4.0.0
<PackageReference Include="MQContract.CQRS" Version="4.0.0" />
<PackageVersion Include="MQContract.CQRS" Version="4.0.0" />
<PackageReference Include="MQContract.CQRS" />
paket add MQContract.CQRS --version 4.0.0
#r "nuget: MQContract.CQRS, 4.0.0"
#:package MQContract.CQRS@4.0.0
#addin nuget:?package=MQContract.CQRS&version=4.0.0
#tool nuget:?package=MQContract.CQRS&version=4.0.0
<a name='assembly'></a>
MQContract.CQRS
Contents
- CommandAttribute
- CommandCallException
- CommandTimeoutException
- Context
- ICQRSConnection
- ExecuteCommandAsync``1(command,context,cancellationToken)
- ExecuteCommandAsync``2(command,context,timeout,cancellationToken)
- ExecuteQueryAsync``2(query,context,timeout,cancellationToken)
- RegisterCommandProcessorAsync``1(processor,group)
- RegisterCommandProcessorAsync``2(processor,group)
- RegisterQueryProcessorAsync``2(processor,group)
- ICQRSConnectionExtension
- ICommand
- ICommandInvocationContext`1
- ICommandProcessor`1
- ICommandProcessor`2
- ICommand`1
- IContextFilteredProcessor
- IContractConnectionExtension
- IFilteredCommandProcessor`1
- IFilteredQueryProcessor`2
- IInvocationContext
- IProcessor
- IQuery
- IQueryInvocationContext`1
- IQueryProcessor`2
- InvalidConnectionException
- QueryAttribute
- QueryCallException
<a name='T-MQContract-CQRS-Attributes-CommandAttribute'></a>
CommandAttribute type
Namespace
MQContract.CQRS.Attributes
Summary
Use this attribute to specify the Channel, TypeName and or TypeVersion of the Command being defined
Parameters
| Name | Type | Description |
|---|---|---|
| channel | T:MQContract.CQRS.Attributes.CommandAttribute | The channel to be used |
Example
[Command(channel: "UserCommands", typeName: "CreateUser", typeVersion: "1.0.0")]
public record CreateUserCommand(string UserId, string UserName, string Email) : ICommand;
<a name='M-MQContract-CQRS-Attributes-CommandAttribute-#ctor-System-String,System-String,System-String-'></a>
#ctor(channel,typeName,typeVersion) constructor
Summary
Use this attribute to specify the Channel, TypeName and or TypeVersion of the Command being defined
Parameters
| Name | Type | Description |
|---|---|---|
| channel | System.String | The channel to be used |
| typeName | System.String | The command type to use |
| typeVersion | System.String | The command type version to use |
Example
[Command(channel: "UserCommands", typeName: "CreateUser", typeVersion: "1.0.0")]
public record CreateUserCommand(string UserId, string UserName, string Email) : ICommand;
<a name='T-MQContract-CQRS-CommandCallException'></a>
CommandCallException type
Namespace
MQContract.CQRS
Summary
Thrown when a command execution call throws an error from the underlying contract connection
<a name='P-MQContract-CQRS-CommandCallException-Error'></a>
Error property
Summary
The error that occured while attempting to execute a given command
<a name='T-MQContract-CQRS-CommandTimeoutException'></a>
CommandTimeoutException type
Namespace
MQContract.CQRS
Summary
Thrown when a command call's timeout is exceeded prior to a response being returned
<a name='T-MQContract-CQRS-Context'></a>
Context type
Namespace
MQContract.CQRS
Summary
Houses the given transmission context for a command or query. This is used to pass on additional string properties between calls as well as houses the unique identifiers that can be used to link chained commands/queries
<a name='M-MQContract-CQRS-Context-#ctor'></a>
#ctor() constructor
Summary
Default constructor
Parameters
This constructor has no parameters.
<a name='P-MQContract-CQRS-Context-CorrelationId'></a>
CorrelationId property
Summary
The unique identifier for the given message chain
<a name='P-MQContract-CQRS-Context-Item-System-String-'></a>
Item property
Summary
Used to add/remove values in the context
Returns
The value that is currently assigned to the provided key or null if missing
Parameters
| Name | Type | Description |
|---|---|---|
| key | System.String | The key for the value to access |
<a name='P-MQContract-CQRS-Context-Keys'></a>
Keys property
Summary
The list of the available keys
<a name='P-MQContract-CQRS-Context-MessageId'></a>
MessageId property
Summary
The unique identifier for the given message
<a name='T-MQContract-CQRS-Interfaces-ICQRSConnection'></a>
ICQRSConnection type
Namespace
MQContract.CQRS.Interfaces
Summary
The primary interface for all CQRS operations. This is used to both execute commands/queries as well as to register processors for those items
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-ExecuteCommandAsync1-0,MQContract-CQRS-Context,System-Threading-CancellationToken-'></a>
ExecuteCommandAsync``1(command,context,cancellationToken) method
Summary
Called to execute a command of the given type
Returns
A ValueTask to allow for async execution
Parameters
| Name | Type | Description |
|---|---|---|
| command | ``0 | The command to execute |
| context | MQContract.CQRS.Context | The context to use if desired |
| cancellationToken | System.Threading.CancellationToken | A cancellation token to use if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command to execute |
Example
var context = new Context();
await cqrsConnection.ExecuteCommandAsync(new CreateUserCommand("user123", "John", "john@example.com"), context);
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-ExecuteCommandAsync2-0,MQContract-CQRS-Context,System-Nullable{System-TimeSpan},System-Threading-CancellationToken-'></a>
ExecuteCommandAsync``2(command,context,timeout,cancellationToken) method
Summary
Called to execute a command of the given type that is expected to provide a given response
Returns
The exepected result type
Parameters
| Name | Type | Description |
|---|---|---|
| command | ``0 | The command to execute |
| context | MQContract.CQRS.Context | The context to use if desired |
| timeout | System.Nullable{System.TimeSpan} | The timeout to allow for the execution, if not specified the underlying contract connection defaults will apply |
| cancellationToken | System.Threading.CancellationToken | A cancellation token to use if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command to execute |
| TCommandResult | The type of response to expect |
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-ExecuteQueryAsync2-0,MQContract-CQRS-Context,System-Nullable{System-TimeSpan},System-Threading-CancellationToken-'></a>
ExecuteQueryAsync``2(query,context,timeout,cancellationToken) method
Summary
Called to execute a query of the given type
Returns
The exepected result type
Parameters
| Name | Type | Description |
|---|---|---|
| query | ``0 | The query to execute |
| context | MQContract.CQRS.Context | The context to use if desired |
| timeout | System.Nullable{System.TimeSpan} | The timeout to allow for the execution, if not specified the underlying contract connection defaults will apply |
| cancellationToken | System.Threading.CancellationToken | A cancellation token to use if desired |
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of query to execute |
| TQueryResponse | The type of response to expect |
Example
var context = new Context();
var user = await cqrsConnection.ExecuteQueryAsync<GetUserQuery, User>(new GetUserQuery("user123"), context, TimeSpan.FromSeconds(10));
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-RegisterCommandProcessorAsync1-MQContract-CQRS-Interfaces-Command-ICommandProcessor{0},System-String-'></a>
RegisterCommandProcessorAsync``1(processor,group) method
Summary
Register a Command processor
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| processor | MQContract.CQRS.Interfaces.Command.ICommandProcessor{``0} | The command processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command the processor handles |
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-RegisterCommandProcessorAsync2-MQContract-CQRS-Interfaces-Command-ICommandProcessor{0,``1},System-String-'></a>
RegisterCommandProcessorAsync``2(processor,group) method
Summary
Register a Command processor for a command with a response
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| processor | MQContract.CQRS.Interfaces.Command.ICommandProcessor{``0,``1} | The command processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command the processor handles |
| TCommandResult | The type of response for the command call |
<a name='M-MQContract-CQRS-Interfaces-ICQRSConnection-RegisterQueryProcessorAsync2-MQContract-CQRS-Interfaces-Query-IQueryProcessor{0,``1},System-String-'></a>
RegisterQueryProcessorAsync``2(processor,group) method
Summary
Register a Query processor
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| processor | MQContract.CQRS.Interfaces.Query.IQueryProcessor{``0,``1} | The query processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of Query the processor handles |
| TQueryResponse | The type of response for the query call |
<a name='T-MQContract-CQRS-Extensions-ICQRSConnectionExtension'></a>
ICQRSConnectionExtension type
Namespace
MQContract.CQRS.Extensions
Summary
Extension calls used to provide a Fluent style set of calls for registering the different processors.
<a name='M-MQContract-CQRS-Extensions-ICQRSConnectionExtension-RegisterCommandProcessorAsync1-System-Threading-Tasks-ValueTask{MQContract-CQRS-Interfaces-ICQRSConnection},MQContract-CQRS-Interfaces-Command-ICommandProcessor{0},System-String-'></a>
RegisterCommandProcessorAsync``1(cqrsConnectionTask,processor,group) method
Summary
Register a Command processor
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| cqrsConnectionTask | System.Threading.Tasks.ValueTask{MQContract.CQRS.Interfaces.ICQRSConnection} | The previous registration call task |
| processor | MQContract.CQRS.Interfaces.Command.ICommandProcessor{``0} | The command processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command the processor handles |
<a name='M-MQContract-CQRS-Extensions-ICQRSConnectionExtension-RegisterCommandProcessorAsync2-System-Threading-Tasks-ValueTask{MQContract-CQRS-Interfaces-ICQRSConnection},MQContract-CQRS-Interfaces-Command-ICommandProcessor{0,``1},System-String-'></a>
RegisterCommandProcessorAsync``2(cqrsConnectionTask,processor,group) method
Summary
Register a Command processor for a command with a response
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| cqrsConnectionTask | System.Threading.Tasks.ValueTask{MQContract.CQRS.Interfaces.ICQRSConnection} | The previous registration call task |
| processor | MQContract.CQRS.Interfaces.Command.ICommandProcessor{``0,``1} | The command processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command the processor handles |
| TCommandResult | The type of response for the command call |
<a name='M-MQContract-CQRS-Extensions-ICQRSConnectionExtension-RegisterQueryProcessorAsync2-System-Threading-Tasks-ValueTask{MQContract-CQRS-Interfaces-ICQRSConnection},MQContract-CQRS-Interfaces-Query-IQueryProcessor{0,``1},System-String-'></a>
RegisterQueryProcessorAsync``2(cqrsConnectionTask,processor,group) method
Summary
Register a Query processor
Returns
The underlying CQRS connection
Parameters
| Name | Type | Description |
|---|---|---|
| cqrsConnectionTask | System.Threading.Tasks.ValueTask{MQContract.CQRS.Interfaces.ICQRSConnection} | The previous registration call task |
| processor | MQContract.CQRS.Interfaces.Query.IQueryProcessor{``0,``1} | The query processor to register |
| group | System.String | The group name to assign it if desired |
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of Query the processor handles |
| TQueryResponse | The type of response for the query call |
<a name='T-MQContract-CQRS-Interfaces-Command-ICommand'></a>
ICommand type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Used to identify a command type
<a name='T-MQContract-CQRS-Interfaces-Command-ICommandInvocationContext`1'></a>
ICommandInvocationContext`1 type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Represents a given execution context for a command
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command housed within this context |
<a name='P-MQContract-CQRS-Interfaces-Command-ICommandInvocationContext`1-Command'></a>
Command property
Summary
The command for this invocation context instance
<a name='T-MQContract-CQRS-Interfaces-Command-ICommandProcessor`1'></a>
ICommandProcessor`1 type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Defines a command processor for the given type of command
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command |
Example
public class CreateUserProcessor : ICommandProcessor<CreateUserCommand>
{
public async ValueTask ProcessCommandAsync(ICommandInvocationContext<CreateUserCommand> context, CancellationToken cancellationToken)
{
var command = context.Command;
// Process the command (e.g., save to database)
Console.WriteLine($"User created: {command.UserName}");
}
void IProcessor.ErrorRecieved(Exception error)
{
Console.WriteLine($"Error: {error.Message}");
}
}
<a name='M-MQContract-CQRS-Interfaces-Command-ICommandProcessor1-ProcessCommandAsync-MQContract-CQRS-Interfaces-Command-ICommandInvocationContext{0},System-Threading-CancellationToken-'></a>
ProcessCommandAsync(invocationContext,cancellationToken) method
Summary
The callback executed against the command
Returns
A ValueTask for async purposes
Parameters
| Name | Type | Description |
|---|---|---|
| invocationContext | MQContract.CQRS.Interfaces.Command.ICommandInvocationContext{`0} | The current invocation context for this command instance |
| cancellationToken | System.Threading.CancellationToken | A cancellation token |
<a name='T-MQContract-CQRS-Interfaces-Command-ICommandProcessor`2'></a>
ICommandProcessor`2 type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Defines a command processor for the given type of command that expects a response
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command |
| TCommandResult | The type of response from the command |
<a name='M-MQContract-CQRS-Interfaces-Command-ICommandProcessor2-ProcessCommandAsync-MQContract-CQRS-Interfaces-Command-ICommandInvocationContext{0},System-Threading-CancellationToken-'></a>
ProcessCommandAsync(invocationContext,cancellationToken) method
Summary
The callback executed against the command
Returns
The result from the command execution
Parameters
| Name | Type | Description |
|---|---|---|
| invocationContext | MQContract.CQRS.Interfaces.Command.ICommandInvocationContext{`0} | The current invocation context for this command instance |
| cancellationToken | System.Threading.CancellationToken | A cancellation token |
<a name='T-MQContract-CQRS-Interfaces-Command-ICommand`1'></a>
ICommand`1 type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Used to identify a command type that is expected to provide a response
Generic Types
| Name | Description |
|---|---|
| TCommandResult | The type of response expected from this command |
<a name='T-MQContract-CQRS-Interfaces-IContextFilteredProcessor'></a>
IContextFilteredProcessor type
Namespace
MQContract.CQRS.Interfaces
Summary
Used to define a processor that will filter incoming calls based on the context
<a name='P-MQContract-CQRS-Interfaces-IContextFilteredProcessor-Filter'></a>
Filter property
Summary
The filter callback that will be supplied a context instance and will return a filter type response
<a name='T-MQContract-CQRS-Extensions-IContractConnectionExtension'></a>
IContractConnectionExtension type
Namespace
MQContract.CQRS.Extensions
Summary
Houses extension methods for the CQRS connections linked to a Contract Connection
<a name='M-MQContract-CQRS-Extensions-IContractConnectionExtension-CreateCQRSConnection-MQContract-Interfaces-IContractConnection,System-String-'></a>
CreateCQRSConnection(contractConnection,cancelationTokenChannel) method
Summary
Creates a CQRS connection instance linked to the given contract connection WARNING: THe Contract Connection cannot be a MultiService style connection, it only supports the single instance or mapped.
Returns
Parameters
| Name | Type | Description |
|---|---|---|
| contractConnection | MQContract.Interfaces.IContractConnection | The contract connection it will be linked to. |
| cancelationTokenChannel | System.String | The channel to use for distributing cancelling token Cancel calls |
Example
var contractConnection = ContractConnection.Instance(new InMemory.Connection());
var cqrsConnection = contractConnection.CreateCQRSConnection("CQRSChannel");
<a name='T-MQContract-CQRS-Interfaces-Command-IFilteredCommandProcessor`1'></a>
IFilteredCommandProcessor`1 type
Namespace
MQContract.CQRS.Interfaces.Command
Summary
Used to define a command processor that will filter incoming messages based on the command
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command that this processor handles |
<a name='P-MQContract-CQRS-Interfaces-Command-IFilteredCommandProcessor`1-Filter'></a>
Filter property
Summary
The filter callback expected to return a filter result and will be supplied the current context and command instance
<a name='T-MQContract-CQRS-Interfaces-Query-IFilteredQueryProcessor`2'></a>
IFilteredQueryProcessor`2 type
Namespace
MQContract.CQRS.Interfaces.Query
Summary
Used to define a query processor that will filter incoming messages based on the query
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of query that this processor handles |
| TQueryResponse | The type of response that this query processor provides |
<a name='P-MQContract-CQRS-Interfaces-Query-IFilteredQueryProcessor`2-Filter'></a>
Filter property
Summary
The filter callback expected to return a filter result and will be supplied the current context and query instance
<a name='T-MQContract-CQRS-Interfaces-IInvocationContext'></a>
IInvocationContext type
Namespace
MQContract.CQRS.Interfaces
Summary
Defines an invocation context for a given message and or query instance
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-Activity'></a>
Activity property
Summary
The underlying activity used with OTEL. This will be set if the underlying Contract Connection being used had OTEL enabled.
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-CausationId'></a>
CausationId property
Summary
The id of a source message if there is one through call chaining
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-CorrelationId'></a>
CorrelationId property
Summary
The unique id for the given message chain
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-Item-System-String-'></a>
Item property
Summary
Used to set and get context specific data (current invocation context)
Returns
The stored context value for the given key or null when missing
Parameters
| Name | Type | Description |
|---|---|---|
| key | System.String | The key for the data to retrieve |
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-Keys'></a>
Keys property
Summary
The available keys that exist in this context
<a name='P-MQContract-CQRS-Interfaces-IInvocationContext-MessageId'></a>
MessageId property
Summary
The unique id for the given message
<a name='M-MQContract-CQRS-Interfaces-IInvocationContext-ExecuteCommandAsync1-0-'></a>
ExecuteCommandAsync``1(command) method
Summary
Called to execute a command of the given type through the current context
Returns
A ValueTask to allow for async execution
Parameters
| Name | Type | Description |
|---|---|---|
| command | ``0 | The command to execute |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command to execute |
Remarks
Tags: mqcontract.cqrs.correlationid = CorrelationId mqcontract.cqrs.messageid = MessageId mqcontract.cqrs.causationid = CausationId mqcontract.cqrs.type = CQRS type (query or command)
<a name='M-MQContract-CQRS-Interfaces-IInvocationContext-ExecuteCommandAsync2-0,System-Nullable{System-TimeSpan}-'></a>
ExecuteCommandAsync``2(command,timeout) method
Summary
Called to execute a command of the given type that is expected to provide a given response through the current context
Returns
The exepected result type
Parameters
| Name | Type | Description |
|---|---|---|
| command | ``0 | The command to execute |
| timeout | System.Nullable{System.TimeSpan} | The timeout to allow for the execution, if not specified the underlying contract connection defaults will apply |
Generic Types
| Name | Description |
|---|---|
| TCommand | The type of command to execute |
| TCommandResult | The type of response to expect |
<a name='M-MQContract-CQRS-Interfaces-IInvocationContext-ExecuteQueryAsync2-0,System-Nullable{System-TimeSpan}-'></a>
ExecuteQueryAsync``2(query,timeout) method
Summary
Called to execute a query of the given type through the current context
Returns
The exepected result type
Parameters
| Name | Type | Description |
|---|---|---|
| query | ``0 | The query to execute |
| timeout | System.Nullable{System.TimeSpan} | The timeout to allow for the execution, if not specified the underlying contract connection defaults will apply |
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of query to execute |
| TQueryResponse | The type of response to expect |
<a name='T-MQContract-CQRS-Interfaces-IProcessor'></a>
IProcessor type
Namespace
MQContract.CQRS.Interfaces
Summary
The base interface housing common calls for a Processor
<a name='M-MQContract-CQRS-Interfaces-IProcessor-ErrorRecieved-System-Exception-'></a>
ErrorRecieved(error) method
Summary
Called when an error is supplied from the underlying Contract Connection
Parameters
| Name | Type | Description |
|---|---|---|
| error | System.Exception | The error that occured |
<a name='T-MQContract-CQRS-Interfaces-Query-IQuery'></a>
IQuery type
Namespace
MQContract.CQRS.Interfaces.Query
Summary
Used to identify a query type
<a name='T-MQContract-CQRS-Interfaces-Query-IQueryInvocationContext`1'></a>
IQueryInvocationContext`1 type
Namespace
MQContract.CQRS.Interfaces.Query
Summary
Represents a given execution context for a query
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of query housed within this context |
<a name='P-MQContract-CQRS-Interfaces-Query-IQueryInvocationContext`1-Query'></a>
Query property
Summary
The query for this invocation context instance
<a name='T-MQContract-CQRS-Interfaces-Query-IQueryProcessor`2'></a>
IQueryProcessor`2 type
Namespace
MQContract.CQRS.Interfaces.Query
Summary
Defines a query processor for the given type of query that expects the given response
Generic Types
| Name | Description |
|---|---|
| TQuery | The type of query |
| TQueryResponse | The type of response from the query |
Example
public class GetUserProcessor : IQueryProcessor<GetUserQuery, User>
{
public async ValueTask<User> ProcessQueryAsync(IQueryInvocationContext<GetUserQuery> context, CancellationToken cancellationToken)
{
var query = context.Query;
// Process the query (e.g., retrieve from database)
return new User(query.UserId, "John", "john@example.com");
}
void IProcessor.ErrorRecieved(Exception error)
{
Console.WriteLine($"Error: {error.Message}");
}
}
<a name='M-MQContract-CQRS-Interfaces-Query-IQueryProcessor2-ProcessQueryAsync-MQContract-CQRS-Interfaces-Query-IQueryInvocationContext{0},System-Threading-CancellationToken-'></a>
ProcessQueryAsync(invocationContext,cancellationToken) method
Summary
the callback executed against the query
Returns
The result from the query execution
Parameters
| Name | Type | Description |
|---|---|---|
| invocationContext | MQContract.CQRS.Interfaces.Query.IQueryInvocationContext{`0} | The current invocation context for this query instance |
| cancellationToken | System.Threading.CancellationToken | A cancellation token |
<a name='T-MQContract-CQRS-InvalidConnectionException'></a>
InvalidConnectionException type
Namespace
MQContract.CQRS
Summary
Thrown when an invalid contract connection type is supplied in an attempt to create a CQRS connection
<a name='T-MQContract-CQRS-Attributes-QueryAttribute'></a>
QueryAttribute type
Namespace
MQContract.CQRS.Attributes
Summary
Use this attribute to specify the Channel, TypeName, TypeVersion, Response Channel and or Response timeout for the Query being defined
Parameters
| Name | Type | Description |
|---|---|---|
| channel | T:MQContract.CQRS.Attributes.QueryAttribute | The channel to be used |
Example
[Query(channel: "UserQueries", typeName: "GetUser", typeVersion: "1.0.0", responseChannel: "UserResponses")]
public record GetUserQuery(string UserId) : IQuery;
<a name='M-MQContract-CQRS-Attributes-QueryAttribute-#ctor-System-String,System-String,System-String,System-String,System-Int32-'></a>
#ctor(channel,typeName,typeVersion,responseChannel,responseTimeoutMilliseconds) constructor
Summary
Use this attribute to specify the Channel, TypeName, TypeVersion, Response Channel and or Response timeout for the Query being defined
Parameters
| Name | Type | Description |
|---|---|---|
| channel | System.String | The channel to be used |
| typeName | System.String | The query type to use |
| typeVersion | System.String | The query type version to use |
| responseChannel | System.String | The responce channel to be used when an underlying service connection does not support QueryResponse or Inbox |
| responseTimeoutMilliseconds | System.Int32 | The query response timeout to default to |
Example
[Query(channel: "UserQueries", typeName: "GetUser", typeVersion: "1.0.0", responseChannel: "UserResponses")]
public record GetUserQuery(string UserId) : IQuery;
<a name='T-MQContract-CQRS-QueryCallException'></a>
QueryCallException type
Namespace
MQContract.CQRS
Summary
Thrown when a query execution call throws an error from the underlying contract connection
<a name='P-MQContract-CQRS-QueryCallException-Error'></a>
Error property
Summary
The error that occured while attempting to execute a given query
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MQContract.Abstractions (>= 4.0.0)
-
net8.0
- MQContract.Abstractions (>= 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 131 | 7/9/2026 |
| 3.9.2 | 130 | 3/26/2026 |
| 3.9.1 | 116 | 3/18/2026 |
| 3.9.0 | 123 | 3/1/2026 |
| 3.8.0 | 129 | 2/26/2026 |
| 3.7.0 | 124 | 2/22/2026 |
| 3.6.0 | 128 | 2/6/2026 |
| 3.5.2 | 130 | 1/27/2026 |
| 3.5.1 | 135 | 1/22/2026 |
| 3.5.0 | 125 | 1/20/2026 |
| 3.4.0 | 130 | 1/13/2026 |
| 3.3.0 | 145 | 11/29/2025 |
| 3.2.0 | 208 | 11/28/2025 |
| 3.1.1 | 174 | 11/23/2025 |
| 3.1.0 | 427 | 11/20/2025 |
| 3.0.0 | 423 | 11/17/2025 |