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

    Show / Hide Table of Contents

    Interface IDataSourceTarget

    Represents a data source that can be the recipient of Data. This basically means it has an In IDataStream

    Inherited Members
    IDataSourceShared.Guid
    IDataSourceShared.Name
    Namespace: ToSic.Eav.DataSources
    Assembly: ToSic.Eav.DataSources.dll
    Syntax
    [PublicApi]
    public interface IDataSourceTarget : IDataTarget, IDataSourceShared
    Remarks

    New in v15.04 as it replaces the old IDataTarget because of confusing names.

    Properties

    | Improve this Doc View Source

    In

    List of all In connections

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

    Methods

    | Improve this Doc View Source

    Attach(String, IDataSource, String)

    Add a single named stream to the In

    Declaration
    void Attach(string streamName, IDataSource dataSource, string sourceName = "Default")
    Parameters
    Type Name Description
    System.String streamName

    In-name of the stream

    IDataSource dataSource

    The data source - will use it's default out

    System.String sourceName

    The stream name on the source, will default to "Default"

    | Improve this Doc View Source

    Attach(String, IDataStream)

    Add a single named stream to the In

    Declaration
    void Attach(string streamName, IDataStream dataStream)
    Parameters
    Type Name Description
    System.String streamName

    In-name of the stream

    IDataStream dataStream

    The data stream to attach

    | Improve this Doc View Source

    Attach(IDataSource)

    Attach a DataSource to In - replaces all existing in-streams.

    Declaration
    void Attach(IDataSource dataSource)
    Parameters
    Type Name Description
    IDataSource dataSource

    DataSource to attach

    | Improve this Doc View Source

    TryGetIn(String)

    Get a specific Stream from In. If it doesn't exist return false and place the error message in the list for returning to the caller.

    Usage usually like this in your GetList() function:

    private IImmutableList<IEntity> GetList()
    {
      var source = TryGetIn();
      if (source is null) return Error.TryGetInFailed(this);
      var result = source.Where(s => ...).ToImmutableList();
      return result;
    }

    Or if you're using Call Logging do something like this:

    private IImmutableList<IEntity> GetList() => Log.Func(l =>
    {
      var source = TryGetIn();
      if (source is null) return (Error.TryGetInFailed(this), "error");
      var result = source.Where(s => ...).ToImmutableList();
      return (result, $"ok - found: {result.Count}");
    });
    Declaration
    [PublicApi]
    IImmutableList<IEntity> TryGetIn(string name = "Default")
    Parameters
    Type Name Description
    System.String name

    Stream name - optional

    Returns
    Type Description
    System.Collections.Immutable.IImmutableList<IEntity>

    A list containing the data, or null if not found / something breaks.

    Remarks

    Introduced in 2sxc 11.13

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