- Notifications
You must be signed in to change notification settings - Fork1
Simple command pattern framework for .NET Core and ASP.NET Core
License
odds-bods/EasyCommand
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
EasyCommand.AspNetCore is in pre-release and is available as aNuGet package.
EasyCommand trivialises the use of the command pattern in .NET Core and ASP.NET Core.
this.ExecuteAsync(this.Command<GetCommand>());
It is an opinionated, light, command pattern framework.
publicclassGetCommandParamId:AsyncAspCommand<int,string>{protectedoverrideTask<string>ExecuteCommandAsync(intrequest){returnTask.FromResult("value");}}
You can execute commands straight from an ASP.NET Core controller (so you can better componentise your code) and this can assist with separating application protocol and business logic.
[HttpGet]publicasyncTask<ActionResult<IEnumerable<string>>>Get(){returnawaitthis.ExecuteAsync(this.Command<GetCommand>());}
You can call commands from other commands.
publicclassFirstCommand:AsyncAspCommand<int,int>{protectedoverrideasyncTask<int>ExecuteCommandAsync(intrequest){returnawaitthis.ExecuteAsync(this.Command<SecondCommand>(),request);}}
As with ASP.NET controllers, EasyCommand supports the .NET Core service dependency registration and injection model.
publicclassSecondCommand:AsyncAspCommand<int,int>{privatereadonlyIRandomServicerandomService;publicSecondCommand(IRandomServicerandomService){this.randomService=randomService;}protectedoverrideTask<int>ExecuteCommandAsync(intrequest){returnTask.FromResult(request+randomService.Next());}}
About
Simple command pattern framework for .NET Core and ASP.NET Core
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.