Skip to content

Templates

The Suite Framework includes several templates to be used with the dotnet CLI.

Gotchas

Currently, Visual Studio does not support loading these templates for the File New Project window, however, this is something they are working on.

Current Templates are aimed to be used inside the Suite Monorepo and will most likely require changes if used outside of the repo. Mainly, referencing packages instead of csprojs, and TargetFramework through Directory.build.props is required.

Installation

Make sure you have setup your development environment before continuing.

You may need to update them when changes or new templates are introduced. For that, you can run:

Bash
# at repository root
./scripts/setup-environment.sh

Usage

You can then use the templates by providing a name and an output path for the sources, which is, by convention, the same as the name...

Templates are always executed at the dotnet directory from an activated UNIX shell!

Bash
1
2
3
source ./activate.sh
dotnet new suiteaspnetapp -o ./src/services/Users/ITsynch.Suite.Users.Application \
    -n ITsynch.Suite.Users.Application

Note

If you see any errors, make sure you have run the setupEnvironment script and that you are running in an activated UNIX shell.

The -o is an alias for the output directory, and the -n is an alias for the csproj name.

Valid template names are:

  1. suitemodule: Creates an empty project with a single SuiteModule
  2. suitemvcmodule: Creates an empty project with a AspNetSuiteModule containing Mvc assets (such as views).
  3. suiteuilocalizationmodule: Creates an empty project containing localizable resources for UI applications.
  4. aspnetsuitemodule: Creates an empty project with a single AspNetSuiteModule
  5. suiteconsoleapp: Creates an empty Suite Console Application
  6. suiteaspnetapp: Creates an empty Suite ASP.NET Application
  7. suitetests: Creates an empty Suite xUnit Tests project
  8. microservice: Creates a clean architecture layout for microservices
  9. microserviceclient: Creates a Client Module for a Microservice.

Tip

You can learn how to use these by using the dotnet new --help and also dotnet new suitemodule --help or other template short names. Additionally, you can add --dry-run when executing dotnet new so that no files are generated but it shows you what it would do if it were run without dry run.

Microservice Template

The microservice template is the easiest way for getting started building a service. It will create the required projects based on the Suite Conventions and can be used as below:

Bash
dotnet new microservice -n EquipmentManager --EntityName Equipment

Note that we don't need to provide any ITsynch suffix, they will be added automatically.

When creating multiple services inside a the same bounded context, it needs to be used like so:

Bash
1
2
3
dotnet new microservice -n Maintenance.EquipmentManager \
    --EntityName Equipment \
    --BoundedContext Maintenance

Microservice Client Template

The microserviceclient template provides an easy way to add a Client for a microservice based on the Suite Conventions and can be used as below:

Bash
dotnet new microserviceclient -n Maintenance.EquipmentManager \
    --BoundedContext Maintenance --EntityName EquipmentMetadata

Notice how we are using the same name (-n) we used for the microservice, this is intentional as the template will automatically append the client suffix when needed. This will create a main project for the Client Module, an Abstractions project for the client entity and also a Tests project for holding the tests.