Table of Contents

Class ServiceBase

Namespace
ToSic.Sys.Services
Assembly
ToSic.Sys.Core.dll

Main base class for most services which have Logs.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public abstract class ServiceBase : IHasLog
Inheritance
object
ServiceBase
Implements
Derived

Remarks

This is quite internal but used heavily. If you are creating DLLs using 2sxc, this may be a good choice, just remember to check if this changes in future versions.

Notes

  • Also has an API to auto-connect the logs of child-services.

Constructors

ServiceBase(string, NoParamOrder, object[]?)

Main constructor.

protected ServiceBase(string logName, NoParamOrder npo = default, object[]? connect = null)

Parameters

logName string

The name to use in the log, like "My.Purpose"

npo NoParamOrder

see Convention: Named Parameters

connect object[]

List of services to auto-connect to the logging.

Methods

ConnectLogs(object[])

Connect Log of all dependencies listed in the services array.

protected void ConnectLogs(object[] services)

Parameters

services object[]

One or more services which could implement ToSic.Sys.DI.ILazyInitLog or IHasLog