Table of Contents

Interface IDataService

Namespace
ToSic.Sxc.Services
Assembly
ToSic.Sxc.dll

Services to create DataSources in Razor as well as external (skin) use.

[PublicApi]
public interface IDataService

Remarks

New in v16.00

Methods

GetAppSource(NoParamOrder, object, object)

Get the App DataSource containing the App Data. The Default stream of this source has the data the current user is allowed to see. So public users won't get draft data.

[PublicApi]
IDataSource GetAppSource(NoParamOrder noParamOrder = default, object parameters = null, object options = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

parameters object

Parameters to use - as anonymous object like new { Count = 7, Filter = 3 }

options object

Options how to build/construct the DataSource.

Returns

IDataSource

GetQuery(string, NoParamOrder, IDataSourceLinkable, object)

Get a Query from the current App.

[PublicApi]
IDataSource GetQuery(string name = null, NoParamOrder noParamOrder = default, IDataSourceLinkable attach = null, object parameters = null)

Parameters

name string

Name of the query

noParamOrder NoParamOrder

see Convention: Named Parameters

attach IDataSourceLinkable

Attach in-stream to the query (not yet implemented)

parameters object

Parameters to use - as anonymous object like new { Count = 7, Filter = 3 }

Returns

IDataSource

Remarks

New 16.01

GetSource(NoParamOrder, string, IDataSourceLinkable, object, object, bool?)

Create a DataSource object using it's name. This is only meant for dynamically compiled DataSources which are part of the current App - a new feature in v15.10+. For any other DataSources, use the overload which specifies the type.

[PublicApi]
IDataSource GetSource(NoParamOrder noParamOrder = default, string name = null, IDataSourceLinkable attach = null, object parameters = null, object options = null, bool? debug = null)

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

name string

The name of the DataSource type, which matches the file name and class in the /DataSources/ folder.

attach IDataSourceLinkable

Link to one or more other DataSources / streams to attach upon creation.

parameters object

Parameters to use - as anonymous object like new { Count = 7, Filter = 3 }

options object

Options how to build/construct the DataSource.

debug bool?

Determines if exceptions should be shown. Default is only for Developers.

Returns

IDataSource

Remarks

new v16.00

GetSource<T>(NoParamOrder, IDataSourceLinkable, object, object)

Create a DataSource object using it's type. This is the new, preferred way to get DataSources in v15.06+.

[PublicApi]
T GetSource<T>(NoParamOrder noParamOrder = default, IDataSourceLinkable attach = null, object parameters = null, object options = null) where T : IDataSource

Parameters

noParamOrder NoParamOrder

see Convention: Named Parameters

attach IDataSourceLinkable

Link to one or more other DataSources / streams to attach upon creation.

parameters object

Parameters to use - as anonymous object like new { Count = 7, Filter = 3 }

options object

Options how to build/construct the DataSource.

Returns

T

Type Parameters

T

The type of DataSource, usually from ToSic.Eav.DataSources or ToSic.Sxc.DataSources

Remarks

new v16.00