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
- The service must be a singleton
- The service must implement
System.ComponentModel.INotifyPropertyChanged
- The service properties you wish to persist must be get/set
- 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 collectionServiceCollection services;services.AddShinyService<MyStatefulService>();