Table of Contents

Namespace ToSic.Sys.Services

The EAV system has a powerful structure for services and helpers.

Object Creation

All services should inherit from ServiceBase or ServiceBase<Dependencies>. This is the most common way to create services.

  1. ToSic.Sys.Services.ServiceBase
    This is for services which have a few dependencies.
  2. ToSic.Sys.Services.ServiceBase<Dependencies>
    This is for services which have a lot of dependencies. In this case you'll have to pass the dependencies to the base class. Dependencies usually inherit from ToSic.Sys.Services.DependenciesBase.
  3. ToSic.Sys.Services.HelperBase This is for helpers which are not services and will usually be created in code (not from DI).

You can also just create normal objects and implement ToSic.Sys.Logging.IHasLog.

Note that if you're inheriting from ServiceBase<Dependencies> then the dependencies class should inherit from ToSic.Sys.Services.DependenciesBase.


History

  1. Introduced a long time ago.
  2. Ongoing improvements - the API is considered internal and can change at any time

Classes

DependenciesBase

Base class for all Dependency helpers on services.

DependenciesRecord

Base class for all Dependency helpers on services.

HelperBase

Main base class for most helpers which don't use Dependency Injection.

HelperRecordBase

Main base record for most helpers which don't use Dependency Injection.

ServiceBase

Main base class for most services which have Logs.

ServiceBase<TServices>

Base class for any service which expects a Dependencies class

WarnUseOfUnknown<T>

Object which should be used in the DI of Unknown implementations.

Interfaces

IHasOptions<TOptions>

Experimental; describes a service which has options, which must usually be set at setup.

IIsUnknown

Marks un-implemented objects like SiteUnknown etc.