Table of Contents

Class ServiceWithSetup<TServices, TOptions>

Namespace
ToSic.Sys.Services
Assembly
ToSic.Sys.Core.dll
[InternalApi_DoNotUse_MayChangeWithoutNotice("Still WIP as of v22")]
public abstract class ServiceWithSetup<TServices, TOptions> : ServiceBase, IHasLog, IHasOptions<TOptions>, IServiceWithSetup<TOptions> where TServices : IDependencies where TOptions : class, new()

Type Parameters

TServices
TOptions
Inheritance
object
ServiceWithSetup<TServices, TOptions>
Implements
IHasOptions<TOptions>
Inherited Members

Constructors

ServiceWithSetup(TServices, string, NoParamOrder, object[]?)

Constructor for normal case, with services

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

Parameters

services TServices

Dependencies to auto-attach to property Services

logName string

The new objects name in the logs

npo NoParamOrder

see Convention: Named Parameters

connect object[]

Optional array of services to connect the logs to.

Fields

Services

The services which came through the TDependencies services in the constructor.

protected readonly TServices Services

Field Value

TServices

Properties

MyOptions

The options instance for this service, read-only.

public virtual TOptions MyOptions { get; }

Property Value

TOptions

Remarks

  1. Explicitly with a short name "MyOptions" so that the classes can have a subclass called "Options" without name conflicts.
  2. Will usually default to new/standard options of type TOptions.

Methods

GetDefaultOptions()

Method to generate new / default options. You can override this to provide your own default options.

protected virtual TOptions GetDefaultOptions()

Returns

TOptions

Setup(TOptions)

public virtual void Setup(TOptions options)

Parameters

options TOptions