Create the project

There are several ways to get your Stacks project, or to get parts of it.


Create a new project using the template or add code to an existing project

Install the package

Access Amido.Stacks.CQRS.Template package page in Nuget here.
Copy and execute the command displayed in the page (if you want to get the latest version).
For example,

Run the command to install the package
dotnet new --install Amido.Stacks.CQRS.Templates::0.0.92

Once installed you can either, create a new project (step 2) or add CQRS to an existing project (step 3). Choose one.

Create a new project

Navigate to the folder where you wish to create a new project on.

Run the command to create the project
dotnet new stacks-cqrs-webapi -n Company.Project -do YourDomain

The above command will create a folder and a repository called Company.Project.

Setting the database option

To create a project with CosmosDb as the database you can use the following command

Run the command to create the project with database
dotnet new stacks-cqrs-webapi -n Company.Project -do YourDomain -d CosmosDb

Add CQRS to an existing project

Navigate to the folder where your existing .sln file is located

Run the command to create the project
dotnet new stacks-add-cqrs -n Company.Project -d YourDomain

The above command will create a folder and a repository called Company.Project. Some projects will be added to your .sln file

Template parameter details
  • -n, --name
    • Sets the project name
    • Omitting it will result in the project name being the same as the folder where the command has been ran from
  • -do, --domain
    • Sets the name of the aggregate root object. It is also the name of the collection within CosmosDB instance.
  • -d, --database
    • Configures which database provider to be used.
  • -o
    • Sets the path to where the project is added
    • Omitting the parameter will result in the creation of a new folder

Create the project by cloning GitHub repository

Clone the .NET project to your local machine from here: stacks-dotnet-cqrs repository

Run git clone repository command
git clone git@github.com:amido/stacks-dotnet-cqrs.git

Create the project using the Scaffolding CLI (in redevelopment)

The scaffolding CLI is being redeveloped to offer you more guided choices of Amido Stacks project flavour. Based on the answers, the ready-to-build project template will be produced.



Pros and cons of each option

PROS

  • Has no dependencies.
  • Enables creation of .NET Core projects in Amido Stacks Suite.
  • Enables versioning and access to older versions of Stacks templates
  • Removes out the content not needed from the GitHub repository.

CONS

  • Too many commands to run.