Skip to content

Solution Templates

mattl91 edited this page Mar 9, 2023 · 12 revisions

Harmony Core Logo

Solution Templates

To make it easy to get started with Harmony Core development we provide several solution templates, each of which can be used to create a pre-configured development environment, each of which contains a Visual Studio solution and several projects.

Installing the Templates

The templates are distributed via a NuGet package called Harmony.Core.ProjectTemplates. You can download and install the templates by executing the following command:

dotnet new install Harmony.Core.ProjectTemplates

You can verify that the templates have been installed by typing:

dotnet new --list

This command displays a list of all of the templates that are installed in your environment, and you should see at least three Synergy templates listed:

Templates                        Short Name     Language    Tags
---------------------------------------------------------------------
Synergy EF Provider Solution     efprovider     Synergy     Solution
Harmony Core Starter Solution    harmonycore    Synergy     Solution
Harmony Core Demo Solution       harmonydemo    Synergy     Solution

The "harmonycore" Template

This is the main solution template that most developers will use when first starting out to develop a new Harmony Core service. It provides a pre-configured set of projects, with all of the required NuGet package references in place, but does not contain any pre-generated source code.

Specifically, the harmonycore template provides:

  • A Visual Studio solution file.

  • A solution folder named Solution Items containing a CodeGen user-defined templates file and a batch file (regen.bat) containing the typical CodeGen commands that can be used to generate code to define, configure host, test, and document Harmony Core services.

  • A solution folder named Templates containing the Harmony Core CodeGen templates that can be used to generate the code for services based on your repository.

  • A repository project named Repository containing a sample repository schema file. In most cases, you will want to replace this schema with your own schema data.

  • A .NET Core class library project named Services. This is where the core ASP.NET Web API and OData environments will be defined and configured. Initially, the project only contains a single folder named wwwroot that contains various files that present a simple home page that will be served by the webserver that hosts your services.

  • A .NET Standard class library project named Services.Controllers where web service controller classes will be created. The project initially contains a couple of source files that are sometimes useful when building services. These files will be discussed in other areas of the documentation.

  • A .NET Core console application project named Services.Host which is where code to "self-host" your services will be generated, if you select that option.

  • A .NET Standard class library project named Services.Isolated. If you need to expose code that needs to be isolated from other instances of the same code then this is where you will define that code.

  • A .NET Standard class library project named Services.Models. This is where the various data model and metadata classes will be generated for your services and also where the Entity Framework database context class that provides runtime access your data.

All of these projects have the necessary inter-project and NuGet package references in place and are ready for use.

In addition to the sample repository schema mentioned earlier, we also provide a folder named SampleData that contains sequential data files and XDL files for the data used in the Harmony Core sample environment. This is to allow you to start building services from scratch using our sample environment. If you don't intend to do that then these files can be deleted.

The "harmonydemo" Template

This template creates an environment that is similar to that created by the harmonycore template but includes the following additional components.

  • The regen.bat file is pre-configured to generate various web services based on the Harmony Core sample data, and the batch file has been executed to generate code for the environment.

  • The Services project already contains various source files that are used to configure the sample services. Also, the HTML page in the wwwroot folder has additional content, including various links to example operations for the sample services.

  • The Services.Controllers project contains the code generated web service controllers for the various web services that are included in the environment.

  • The Services.Host project contains various code that has been generated to self-host the sample web services that are defined in the other projects.

The Services.Models project contains various code generated data model and metadata classes, as well as other code used to operate the services.

  • An additional project named 'TraditionalBridge' that contains an example of how to implement a Harmony Core Traditional Bridge environment, essentially providing a way to expose Traditional Synergy subroutines and functions via a RESTful web services API. There is also additional code in the Services.Models and Services.Controllers projects related to this, as well as additional custom startup code in the Services project related to configuring the Traditional Bridge environment.

The "efprovider" Template (EXPERIMENTAL)

This template creates a solution that provides an example of how to use the Synergy EF Provider outside of a Harmony Core environment.

Additional documentation will be provided soon.

Removing the Templates

The Harmony Core solution templates can be removed from your system with the following command:

dotnet new -u Harmony.Core.ProjectTemplates

Next topic: Code Generation


Clone this wiki locally