Table of Contents

Class DataSource16

Namespace
Custom.DataSource
Assembly
ToSic.Sxc.dll

The Base Class for custom Dynamic DataSources in your App.

[PublicApi]
public abstract class DataSource16 : ServiceBase<DataSource16.MyServices>, IDataSource, IDataSourceLinkable, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog
Inheritance
DataSource16
Implements

Constructors

DataSource16(MyServices, string)

Constructor with the option to provide a log name.

protected DataSource16(DataSource16.MyServices services, string logName = null)

Parameters

services DataSource16.MyServices

All the needed services - see Convention: MyServices

logName string

Optional name for logging such as My.JsonDS

Properties

AppId

The app id as used internally

public int AppId { get; }

Property Value

int

The App ID this thing belongs to

Configuration

The configuration system of this data source. Keeps track of all values which the data source will need, and manages the LookUp engine which provides these values.

public IDataSourceConfiguration Configuration { get; }

Property Value

IDataSourceConfiguration

Error

Special helper to generate error-streams.

DataSources should never throw exceptions but instead return a stream containing the error information.

public DataSourceErrorHelper Error { get; }

Property Value

DataSourceErrorHelper

Kit

public ServiceKitLight16 Kit { get; }

Property Value

ServiceKitLight16

A link - or possibly many. In most cases, this references the parent object which provides this/these links.

public IDataSourceLink Link { get; }

Property Value

IDataSourceLink

Log

The logger for the current Razor / WebApi which allows you to add logs to Insights.

public ICodeLog Log { get; }

Property Value

ICodeLog

ZoneId

ID of the zone (EAV Tenant)

public int ZoneId { get; }

Property Value

int

The zone ID this thing belongs to

Methods

GetDefault()

protected virtual IEnumerable<IRawEntity> GetDefault()

Returns

IEnumerable<IRawEntity>

ProvideOut(Func<object>, NoParamOrder, string, Func<DataFactoryOptions>)

protected void ProvideOut(Func<object> getList, NoParamOrder noParamOrder = default, string name = "Default", Func<DataFactoryOptions> options = null)

Parameters

getList Func<object>
noParamOrder NoParamOrder
name string
options Func<DataFactoryOptions>

Setup(IDataSourceOptions, IDataSourceLinkable)

public void Setup(IDataSourceOptions options, IDataSourceLinkable attach)

Parameters

options IDataSourceOptions
attach IDataSourceLinkable

TryGetIn(string)

public IImmutableList<IEntity> TryGetIn(string name = "Default")

Parameters

name string

Returns

IImmutableList<IEntity>

TryGetOut(string)

public IImmutableList<IEntity> TryGetOut(string name = "Default")

Parameters

name string

Returns

IImmutableList<IEntity>