Info
Version: | 2.0.0.21 |
Author(s): | Jobping |
Last Update: | Wednesday, November 14, 2012 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | http://github.com/markkemper1/Commando |
NuGet Url: | https://www.nuget.org/packages/Commando |
Install
Install-Package Commando
dotnet add package Commando
paket add Commando
Commando Download (Unzip the "nupkg" after downloading)
For example a database command might look like this
public class GetUserCommand : DbCommandBase<Use>
{
//Constructor only takes the arguments necessary to run the command
public GetUserCommand(int userId)
{
this.UserId = userId;
}
public int UserId {get;set;}
public override User Execute(IDbConnection db)
{
return db.Query<User>("Select * from User where Id = @UserId", new { UserId}, this.Transaction)
.FirstOrDefault();
}
}
The Command executor will then provide the neccessary DbProviderFactory to the command before execution.
(nb: The DbCommandBase is creating the actual connection)
Commands can all execute other commands, e.g.
this.Execute(new SendNewUserEmailCommand("Johnny", "[email protected]"));
It is then the responsiblity of the Command Executor to provide the necessary email sending service.
More info can be found here.
http://github.com/markkemper1/Commando.