Getting started

Prerequisites

.Net Core SDK version

Cloudstate .Net support requires .Net Core sdk 2.2.

Creating a main function

Your main class will be responsible for creating the Cloudstate gRPC server, registering the entities for your placement and starting it:

using System.Threading.Tasks;
using Google.Protobuf;

namespace EventSourced.ShoppingCart
{
    public static class Program
    {
        public static async Task Main()
        {
            var state = new CloudState.CSharpSupport.CloudState()
                    .RegisterEventSourcedEntity<ShoppingCartEntity>(
                        Com.Example.Shoppingcart.ShoppingCart.Descriptor,
                        Com.Example.Shoppingcart.Persistence.DomainReflection.Descriptor
                    );

            await state.StartAsync();
        }
    }
}

We will see more details on creating entities in the coming pages.