Interface IDataService
Services on Kit.Data to create DataSources in Razor.
[PublicApi]
public interface IDataService
Remarks
Can also be used in external code such as Skins using Dependency Injection. 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
noParamOrderNoParamOrderparametersobjectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }optionsobjectOptions how to build/construct the DataSource.
Returns
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
namestringName of the query
noParamOrderNoParamOrderattachIDataSourceLinkableAttach in-stream to the query (not yet implemented)
parametersobjectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }
Returns
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
noParamOrderNoParamOrdernamestringThe name of the DataSource type, which matches the file name and class in the
/DataSources/folder.attachIDataSourceLinkableLink to one or more other DataSources / streams to attach upon creation.
parametersobjectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }optionsobjectOptions how to build/construct the DataSource.
debugbool?Determines if exceptions should be shown. Default is only for Developers.
Returns
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
noParamOrderNoParamOrderattachIDataSourceLinkableLink to one or more other DataSources / streams to attach upon creation.
parametersobjectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }optionsobjectOptions how to build/construct the DataSource.
Returns
- T
Type Parameters
TThe type of DataSource, usually from ToSic.Eav.DataSources or ToSic.Sxc.DataSources
Remarks
new v16.00