This project is read-only.
A command is a message object representing an action that will change the state of the system. You name a command with a verb. A good best practice is to end the command name with the word "Command" to clearly indicate its purpose.

A command is data-oriented. It is not object-oriented and the intent is send data and not to model anything. Therefore, the properties of the command are primitives. The simplicity of these data types also aids in serialization.

The sample code has several example commands provided. One such example is CreateOrUpdateCategoryCommand.

    using System;
    using FNHMVC.CommandProcessor.Command;
    using FNHMVC.Model;
    using System.Collections.Generic;

    namespace FNHMVC.Model.Commands
    {
        public class CreateOrUpdateCategoryCommand : ICommand
        {
            public int CategoryId { get; set; }
            public string Name { get; set; }
            public string Description { get; set; }
        }
    }



As you can see, the nomenclature is very simple and clearly indicates its intent: to create or update a category. We also know that this is a command.

In the code given above, we create the command by implementing the ICommand interface. This interface is contained within the FNHMVC.CommandProcessor.Command namespace.

Last edited Aug 21, 2015 at 12:51 AM by TheNephalim, version 6

Comments

No comments yet.