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/a647dfd3bc1bc799bda7a9ee0404dc22 to your computer and use it in GitHub Desktop.
Save somapatrik/a647dfd3bc1bc799bda7a9ee0404dc22 to your computer and use it in GitHub Desktop.
Command + Handler snippet
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Command with handler</Title>
<Author>Patrik Šoma</Author>
<Description>SLM Only!</Description>
<Shortcut>cmdhnd</Shortcut>
</Header>
<Snippet>
<Code Language="CSharp">
<![CDATA[
public class $cmdName$Command : CommandBase
{
public $cmdName$Command() { }
}
internal class $cmdName$CommandHandler : ICommandHandler<$cmdName$Command>
{
public Task<Unit> Handle($cmdName$Command request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}
]]>
</Code>
<Declarations>
<Literal>
<ID>cmdName</ID>
<ToolTip>Command name</ToolTip>
<Default>MyCmdName</Default>
</Literal>
</Declarations>
<Imports>
<Import>
<Namespace>
PQS.SLM.BuildingBlocks.Application.Configuration.Commands;
</Namespace>
</Import>
<Import>
<Namespace>
PQS.SLM.BuildingBlocks.Application.Configuration.Contracts;
</Namespace>
</Import>
</Imports>
</Snippet>
</CodeSnippet>
</CodeSnippets>
@krakoram
Copy link

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment