Skip to content

Instantly share code, notes, and snippets.

@somapatrik
Last active January 3, 2024 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save somapatrik/9b149241a1010005fe49d9bb5c83c739 to your computer and use it in GitHub Desktop.
Save somapatrik/9b149241a1010005fe49d9bb5c83c739 to your computer and use it in GitHub Desktop.
Query + Handler
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Query with handler</Title>
<Author>Patrik Šoma</Author>
<Description>SLM only!</Description>
<Shortcut>qryhnd</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[
public class $QueryName$Query : IQuery<$ReturnName$>
{
public $QueryName$Query() { }
}
internal class $QueryName$QueryHandler : IQueryHandler<$QueryName$Query, $ReturnName$>
{
public Task<$ReturnName$> Handle($QueryName$Query request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}
]]>
</Code>
<Declarations>
<Literal>
<ID>QueryName</ID>
<ToolTip>Query name</ToolTip>
<Default>MyQueryName</Default>
</Literal>
<Literal>
<ID>ReturnName</ID>
<ToolTip>Return object</ToolTip>
<Default>ReturnObjectName</Default>
</Literal>
</Declarations>
<Imports>
<Import>
<Namespace>PQS.SLM.BuildingBlocks.Application.Configuration.Queries;</Namespace>
</Import>
<Import>
<Namespace>PQS.SLM.BuildingBlocks.Application.Configuration.Contracts;</Namespace>
</Import>
<Import>
<Namespace>System.Threading;</Namespace>
</Import>
</Imports>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment