Skip to content

Stateful Services

Intro

Stateful services are simple way of maintaining state across execution/restarts/etc. Essentially, you make your service a start

There are 3 requirements to having a stateful service

  1. The service must be a singleton
  2. The service must implement System.ComponentModel.INotifyPropertyChanged
  3. The service properties you wish to persist must be get/set
  4. Your properties must be “simple” types or JSON serializable
using Shiny;
namespace Whatever;
public class MyStatefulService : Shiny.NotifyPropertyChanged
{
}

And registering

using Shiny; // to emerge the extension methods
// wherever you register your services with the service collection
ServiceCollection services;
services.AddShinyService<MyStatefulService>();

TODO