• Basics
  • Abyss
  • Web APIs
  • C# & Razor
  • .net API
  • JS & TS API

    Show / Hide Table of Contents

    Interface IDataSource

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

    Inherited Members
    IDataSourceLinkable.Link
    IZoneIdentity.ZoneId
    IAppIdentityLight.AppId
    ICacheKey.CachePartialKey
    ICacheKey.CacheFullKey
    ICacheExpiring.CacheChanged(Int64)
    ITimestamped.CacheTimestamp
    IHasLog.Log
    Namespace: ToSic.Eav.DataSource
    Assembly: ToSic.Eav.DataSources.dll
    Syntax
    [PublicApi_Stable_ForUseInYourCode]
    public interface IDataSource : IDataSourceLinkable, IAppIdentity, IZoneIdentity, IAppIdentityLight, ICacheInfo, ICacheKey, ICacheExpiring, ITimestamped, ICanPurgeListCache, IHasLog, IDataTarget

    Properties

    | Improve this Doc View Source

    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.

    Declaration
    IDataSourceConfiguration Configuration { get; }
    Property Value
    Type Description
    IDataSourceConfiguration
    | Improve this Doc View Source

    Error

    Special helper to generate error-streams.

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

    Declaration
    DataSourceErrorHelper Error { get; }
    Property Value
    Type Description
    DataSourceErrorHelper
    | Improve this Doc View Source

    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.

    Declaration
    bool Immutable { get; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    New in 15.06

    | Improve this Doc View Source

    In

    List of all In connections.

    Declaration
    IReadOnlyDictionary<string, IDataStream> In { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyDictionary<System.String, IDataStream>

    A dictionary of named IDataStream objects, case insensitive

    | Improve this Doc View Source

    Item[String]

    Gets the Out-Stream with specified Name.

    Declaration
    IDataStream this[string outName] { get; }
    Parameters
    Type Name Description
    System.String outName
    Property Value
    Type Description
    IDataStream

    an IDataStream of the desired name

    Exceptions
    Type Condition
    System.NullReferenceException

    if the stream does not exist

    | Improve this Doc View Source

    List

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

    Declaration
    IEnumerable<IEntity> List { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<IEntity>

    A list of IEntity items in the Default stream.

    | Improve this Doc View Source

    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.

    Declaration
    IReadOnlyDictionary<string, IDataStream> Out { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyDictionary<System.String, IDataStream>

    A dictionary of named IDataStream objects, case insensitive

    Methods

    | Improve this Doc View Source

    GetStream(String, String, Boolean, Boolean)

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

    Declaration
    IDataStream GetStream(string name = null, string noParamOrder = "Params must be named (https://r.2sxc.org/named-params)", bool nullIfNotFound = false, bool emptyIfNotFound = false)
    Parameters
    Type Name Description
    System.String name

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

    System.String noParamOrder

    see Convention: Named Parameters

    System.Boolean nullIfNotFound

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

    System.Boolean emptyIfNotFound

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

    Returns
    Type Description
    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
    Type Condition
    System.NullReferenceException

    if the stream does not exist and nullIfNotFound is false

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX