Interface IDataService
Services to create DataSources in Razor as well as external (skin) use.
Namespace: ToSic.Sxc.Services
Assembly: ToSic.Sxc.dll
Syntax
[PublicApi]
public interface IDataService
Remarks
New in v16.00
Methods
| Improve this Doc View SourceGetAppSource(string, 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.
Declaration
[PublicApi]
IDataSource GetAppSource(string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", object parameters = null, object options = null)
Parameters
Type | Name | Description |
---|---|---|
string | noParamOrder | |
object | parameters | Parameters to use - as anonymous object like |
object | options | Options how to build/construct the DataSource. |
Returns
Type | Description |
---|---|
IDataSource |
GetQuery(string, string, IDataSourceLinkable, object)
Get a Query from the current App.
Declaration
[PublicApi]
IDataSource GetQuery(string name = null, string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", IDataSourceLinkable attach = null, object parameters = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Name of the query |
string | noParamOrder | |
IDataSourceLinkable | attach | Attach in-stream to the query (not yet implemented) |
object | parameters | Parameters to use - as anonymous object like |
Returns
Type | Description |
---|---|
IDataSource |
Remarks
New 16.01
GetSource(string, 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.
Declaration
[PublicApi]
IDataSource GetSource(string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", string name = null, IDataSourceLinkable attach = null, object parameters = null, object options = null, bool? debug = null)
Parameters
Type | Name | Description |
---|---|---|
string | noParamOrder | |
string | name | The name of the DataSource type, which matches the file name and class in the |
IDataSourceLinkable | attach | Link to one or more other DataSources / streams to attach upon creation. |
object | parameters | Parameters to use - as anonymous object like |
object | options | Options how to build/construct the DataSource. |
bool? | debug | Determines if exceptions should be shown. Default is only for Developers. |
Returns
Type | Description |
---|---|
IDataSource |
Remarks
new v16.00
GetSource<T>(string, IDataSourceLinkable, object, object)
Create a DataSource object using it's type. This is the new, preferred way to get DataSources in v15.06+.
Declaration
[PublicApi]
T GetSource<T>(string noParamOrder = "Params must be named (https://go.2sxc.org/named-params)", IDataSourceLinkable attach = null, object parameters = null, object options = null) where T : IDataSource
Parameters
Type | Name | Description |
---|---|---|
string | noParamOrder | |
IDataSourceLinkable | attach | Link to one or more other DataSources / streams to attach upon creation. |
object | parameters | Parameters to use - as anonymous object like |
object | options | Options how to build/construct the DataSource. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type of DataSource, usually from ToSic.Eav.DataSources or ToSic.Sxc.DataSources |
Remarks
new v16.00