Command line interface

The command line interface can be used to manage the model file (.cqrs) and to run the code and documentation generation tools over that model.

Model manipulation commands

Create a new model
  CREATE MODEL modelname


This creates a new .cqrs file with the given model name and adds the outer XML tags required for the model. As this is a plain XML file it can be added to a source control system or a .NET project as required.

The command line tool always operates on the last model it was set to - either by this creaton of a new model or by the "USING modelname" syntax which may precede any command.

Create an aggregate identifier
   [USING modelname]
   ADD AGGREGATE aggregatename
   IDENTIFIED BY keyname
     AS keydatatype
    [AUTOGENERATED]


There are no commands to modify an aggregate. If you need to change one then you have to drop and recreate it

Delete an aggregate identifier
  [USING modelname]
  DELETE AGGREGATE aggregatename


Everything linked to that aggregate (queries, commands, events and projections) will be deleted at the same time.

Documentation

Every entity in the CQRS model can have comments and notes attached to it. The syntax to add or update these is:
     [USING modelname]
     DOCUMENT [AGGREGATE | QUERY | COMMAND | EVENT | PROJECTION] objectname
       DESCRIPTION => ''
       NOTES => ''


This command overwrites any existing notes or comments for that named object.

Add an event
   [USING modelname]
   [FOR AGGREGATE aggregatename]
   ADD EVENT eventname


If the aggregate is not explicitly specified using the FOR AGGREGATE syntax then the event name must contain the aggregate name in dot separated notation. e.g. ADD EVENT customer.addresschanged

Add a property to an event
   [USING modelname]
   [FOR AGGREGATE aggregatename]
   [FOR EVENT eventname]
   ADD PROPERTY eventpropertyname
     AS datatype


This will add the property, setting its "Created version" number to the current version number of the event.

If the aggregate and event name is not explicitly specified using the FOR AGGREGATE / FOR EVENT syntax then the event name must contain the aggregate name and event name in dot separated notation. e.g. ADD PROPERTY customer.addresschanged.postcode AS String

Depreciate an event property

   [USING modelname]
   [FOR AGGREGATE aggregatename]
   [FOR EVENT eventname]
   DEPRECIATE PROPERTY eventpropertyname


This sets an event property as depreciated (by setting the "Depreciated version" to the current event version number. Once the event number is incremented after this then this property is no longer available.

If the aggregate and event name is not explicitly specified using the FOR AGGREGATE / FOR EVENT syntax then the event name must contain the aggregate name and event name in dot separated notation. e.g. DEPRECIATE PROPERTY customer.addresschanged.postcode


Increment an event version
   [USING modelname]
   [FOR AGGREGATE aggregatename]
   VERSION EVENT eventname


Add a command
   [USING modelname]
   [FOR AGGREGATE aggregatename]
   ADD COMMAND commandname


If the aggregate is not explicitly specified using the FOR AGGREGATE syntax then the event name must contain the aggregate name in dot separated notation. e.g. ADD COMMAND customer.changeaddress

Delete a command
   [USING modelname]
   [FOR AGGREGATE aggregatename]
   DELETE COMMAND commandname


(Re)Generating the code

     [USING modelname]
    GENERATE CODE [VB.NET | C#]


This will generate the source code for the .cqrs model in the selected code language. This code can then be imported into a project for use as the command query separation or responsibility backing architecture.

(Re)generating the documentation
     [USING modelname]
    GENERATE DOCUMENTATION


This will generate the HTML documentation for the .cqrs model according to the structure and documentation notes passed into the model.

Last edited Jul 27, 2015 at 8:08 PM by Merrion, version 9