Table of Contents

Class CustomDataSource

Namespace
ToSic.Eav.DataSource
Assembly
ToSic.Eav.DataSources.dll

Very lightweight DataSource base for data sources which are very simple and convention based.

[PublicApi]
public class CustomDataSource : CustomDataSourceAdvanced, IDataSource, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog, IDataSourceLinkable
Inheritance
CustomDataSource
Implements
Derived
Inherited Members

Constructors

CustomDataSource(MyServices, string)

Constructor for creating a Custom DataSource.

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

Parameters

services CustomDataSource.MyServices

All the needed services - see Convention: MyServices

logName string

Optional name for logging such as My.JsonDS

Properties

Immutable

Every new DataSource based on this is immutable.

public override bool Immutable { get; }

Property Value

bool

Methods

GetDefault()

protected virtual IEnumerable<IRawEntity> GetDefault()

Returns

IEnumerable<IRawEntity>

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

Provide data on the Out of this DataSource. This is a very generic version which takes any function that generates a list of something. Internally it will try to detect what the data was and convert it to the final format.

Note that the source must create a list (IEnumerable) of any of the following (all items must have the same type):

If you know what data type you're creating, you should look at the other ProvideOut* methods.

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

Parameters

data Func<object>
noParamOrder NoParamOrder

see Convention: Named Parameters

name string

optional name of the out-stream.

options Func<DataFactoryOptions>

Conversion options which are relevant for IRawEntity data