Interface IDynamicCodeService
This is a service to give you DynamicCode outside of 2sxc.
Use this to access 2sxc data from a Theme, a .ascx
WebControl or anywhere else.
Namespace: ToSic.Sxc.Services
Assembly: ToSic.Sxc.dll
Syntax
[PublicApi]
public interface IDynamicCodeService
Remarks
- New in v13.02
- This is meant to replace the
ToSic.Sxc.Dnn.Factory
. Please use this from now on.
Methods
| Improve this Doc View SourceApp(String, Nullable<Int32>, Nullable<Int32>, ISite, Nullable<Boolean>)
Get a rich IApp object for a specific App.
This is the simplest way to work with data of this App, but won't give you commands like AsDynamic(...)
Declaration
IApp App(string noParamOrder = "Params must be named (https://r.2sxc.org/named-params)", int? zoneId = default(int? ), int? appId = default(int? ), ISite site = null, bool? withUnpublished = default(bool? ))
Parameters
Type | Name | Description |
---|---|---|
System.String | noParamOrder | |
System.Nullable<System.Int32> | zoneId | The ZoneId of the App (optional) |
System.Nullable<System.Int32> | appId | The AppId - REQUIRED |
ToSic.Eav.Context.ISite | site | Site information for further context (optional) |
System.Nullable<System.Boolean> | withUnpublished | Determines if the App.Data gives you unpublished data (like in admin-mode) or just published data. If not set, will default to user permissions. |
Returns
Type | Description |
---|---|
IApp | An initialized App object which you can use to access App.Data |
AppOfSite()
Get a rich IApp object for the primary (aka Site) App of the current Site/Portal and using permissions of the current user.
This is the simplest way to work with data of this App, but won't give you commands like AsDynamic(...)
.
For more control, use the AppOfSite
with parameters.
Declaration
IApp AppOfSite()
Returns
Type | Description |
---|---|
IApp |
AppOfSite(String, Nullable<Int32>, ISite, Nullable<Boolean>)
Get a rich IApp object for the primary (aka Site) App.
This is the simplest way to work with data of this App, but won't give you commands like AsDynamic(...)
Declaration
IApp AppOfSite(string noParamOrder = "Params must be named (https://r.2sxc.org/named-params)", int? siteId = default(int? ), ISite site = null, bool? withUnpublished = default(bool? ))
Parameters
Type | Name | Description |
---|---|---|
System.String | noParamOrder | |
System.Nullable<System.Int32> | siteId | The SiteId which is the PortalId in DNN. Optional - without it, the current Site / Portal is used. |
ToSic.Eav.Context.ISite | site | Site information for further context (optional) |
System.Nullable<System.Boolean> | withUnpublished | Determines if the App.Data gives you unpublished data (like in admin-mode) or just published data. If not set, will default to user permissions. |
Returns
Type | Description |
---|---|
IApp | An initialized App object which you can use to access App.Data |
OfApp(Int32)
Get a IDynamicCode12 object for a specific App. This is the simplest way to work with Dynamic Code for this App.
Note that this is without Page/Module context, so there will be no useful Content
object on the dynamic code.
Declaration
IDynamicCode12 OfApp(int appId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | appId | The AppId |
Returns
Type | Description |
---|---|
IDynamicCode12 | The dynamic code object for this App |
OfApp(Int32, Int32)
Get a IDynamicCode12 object for a specific App. This is the simplest way to work with Dynamic Code for this App.
Note that this is without Page/Module context, so there will be no useful Content
object on the dynamic code.
Declaration
IDynamicCode12 OfApp(int zoneId, int appId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | zoneId | The ZoneId of the App |
System.Int32 | appId | The AppId |
Returns
Type | Description |
---|---|
IDynamicCode12 | The dynamic code object for this App |
OfApp(IAppIdentity)
Get a IDynamicCode12 object for a specific App. This is the simplest way to work with Dynamic Code for this App.
Note that this is without Page/Module context, so there will be no useful Content
object on the dynamic code.
Declaration
IDynamicCode12 OfApp(IAppIdentity appIdentity)
Parameters
Type | Name | Description |
---|---|---|
IAppIdentity | appIdentity | The App Identifier |
Returns
Type | Description |
---|---|
IDynamicCode12 | The dynamic code object for this App |
OfModule(Int32, Int32)
Get a IDynamicCode12 object for a specific Module on a page
Declaration
IDynamicCode12 OfModule(int pageId, int moduleId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageId | |
System.Int32 | moduleId |
Returns
Type | Description |
---|---|
IDynamicCode12 |
OfSite()
Get a IDynamicCode12 object for the primary App of the current Site/Portal.
Declaration
IDynamicCode12 OfSite()
Returns
Type | Description |
---|---|
IDynamicCode12 |
OfSite(Int32)
Get a IDynamicCode12 object for a specific Site/Portal.
Declaration
IDynamicCode12 OfSite(int siteId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | siteId |
Returns
Type | Description |
---|---|
IDynamicCode12 |