Interface IDataService
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
NoParamOrderparameters
objectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }
options
objectOptions 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
name
stringName of the query
noParamOrder
NoParamOrderattach
IDataSourceLinkableAttach in-stream to the query (not yet implemented)
parameters
objectParameters 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
noParamOrder
NoParamOrdername
stringThe name of the DataSource type, which matches the file name and class in the
/DataSources/
folder.attach
IDataSourceLinkableLink to one or more other DataSources / streams to attach upon creation.
parameters
objectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }
options
objectOptions how to build/construct the DataSource.
debug
bool?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
noParamOrder
NoParamOrderattach
IDataSourceLinkableLink to one or more other DataSources / streams to attach upon creation.
parameters
objectParameters to use - as anonymous object like
new { Count = 7, Filter = 3 }
options
objectOptions 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