From c4041dfe58e1144d47db0a126cc143a68be8aeee Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 12 May 2021 10:28:26 +0200 Subject: [PATCH] Update README.md --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 049b84bec..02e552e62 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,69 @@ Workflows can be defined not only using code but also visually and of course JSO ## Getting Started -Working on it. +```bash +dotnet new console -n "MyConsoleApp" + +cd MyConsoleApp + +dotnet add package Elsa --prerelease +dotnet add package Elsa.Activities.Console --prerelease +``` + +Create a new file called `HelloWorldWorkflow.cs` and add the following: + +```csharp +using Elsa.Activities.Console; +using Elsa.Builders; + +namespace MyConsoleApp +{ + public class HelloWorld : IWorkflow + { + public void Build(IWorkflowBuilder builder) => builder.WriteLine("Hello World!"); + } +} +``` + +Modify `Program.cs` as follows: + +```csharp +using System.Threading.Tasks; +using Elsa.Services; +using Microsoft.Extensions.DependencyInjection; + +namespace MyConsoleApp +{ + class Program + { + private static async Task Main() + { + var services = new ServiceCollection() + .AddElsa(options => options + .AddConsoleActivities() + .AddWorkflow()) + .BuildServiceProvider(); + + var workflowRunner = services.GetRequiredService(); + await workflowRunner.BuildAndStartWorkflowAsync(); + } + } +} +``` + +Run the program: + +```bash +dotnet run +``` + +Output: + +```bash +Hello World! +``` + +Check out the [Quickstart guides](https://elsa-workflows.github.io/elsa-core/docs/next/quickstarts/quickstarts-console-hello-world) for more examples, including how to setup the Elsa Dashboard to create and manage visual workflows. ## Roadmap