Table of Contents

Interface IDataSource

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

Public interface for an Eav DataSource. All DataSource objects are based on this.

[PublicApi]
public interface IDataSource : IDataSourceLinkable, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheKey, ICacheExpiring, ITimestamped, IHasLog
Inherited Members

Properties

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.

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.

DataSourceErrorHelper Error { get; }

Property Value

DataSourceErrorHelper

Immutable

Information if the DataSource is Immutable. Reason is that starting in v15, everything should become immutable. So setting parameters or attaching other sources will not be possible any more after initial creation. But because a lot of code is still out there which assumes mutable objects, this is set depending on how the DataSource was created. Newer APIs will result in Immutable DataSources, while older APIs will get you a mutable DataSource. See Convention: Everything is Immutable.

bool Immutable { get; }

Property Value

bool

Remarks

New in 15.06

In

List of all In connections.

IReadOnlyDictionary<string, IDataStream> In { get; }

Property Value

IReadOnlyDictionary<string, IDataStream>

A dictionary of named IDataStream objects, case insensitive

this[string]

Gets the Out-Stream with specified Name.

IDataStream this[string outName] { get; }

Parameters

outName string

Property Value

IDataStream

an IDataStream of the desired name

Exceptions

NullReferenceException

if the stream does not exist

List

The items in the data-source - to be exact, the ones in the Default stream.

IEnumerable<IEntity> List { get; }

Property Value

IEnumerable<IEntity>

A list of IEntity items in the Default stream.

Out

Gets the Dictionary of Out-Streams. This is the internal accessor, as usually you'll use this["name"] instead.
In rare cases you need the Out, for example to list the stream names in the data source.

IReadOnlyDictionary<string, IDataStream> Out { get; }

Property Value

IReadOnlyDictionary<string, IDataStream>

A dictionary of named IDataStream objects, case insensitive

Methods

GetStream(string, NoParamOrder, bool, bool)

Gets the Out-Stream with specified Name and allowing some error handling if not found.

IDataStream GetStream(string name = null, NoParamOrder noParamOrder = default, bool nullIfNotFound = false, bool emptyIfNotFound = false)

Parameters

name string

The desired stream name. If empty, will default to the default stream.

noParamOrder NoParamOrder

see Convention: Named Parameters

nullIfNotFound bool

In case the stream name isn't found, will return null. Ideal for chaining with ??

emptyIfNotFound bool

In case the stream name isn't found, will return an empty stream. Ideal for using LINQ directly.

Returns

IDataStream

an IDataStream of the desired name

Remarks

  1. Added in 2sxc 12.05
  2. for more in-depth checking if a stream exists, you can access the Out which is an IDictionary

Exceptions

NullReferenceException

if the stream does not exist and nullIfNotFound is false