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:
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 | |
|---|---|
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:
suitemodule: Creates an empty project with a single SuiteModulesuitemvcmodule: Creates an empty project with a AspNetSuiteModule containing Mvc assets (such as views).suiteuilocalizationmodule: Creates an empty project containing localizable resources for UI applications.aspnetsuitemodule: Creates an empty project with a single AspNetSuiteModulesuiteconsoleapp: Creates an empty Suite Console Applicationsuiteaspnetapp: Creates an empty Suite ASP.NET Applicationsuitetests: Creates an empty Suite xUnit Tests projectmicroservice: Creates a clean architecture layout for microservicesmicroserviceclient: 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 | |
|---|---|
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 | |
|---|---|
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 | |
|---|---|
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.