Interface IDynamicCodeService
This is a service to give you DynamicCode outside 2sxc.
[PublicApi]
public interface IDynamicCodeService
Remarks
Use this to access 2sxc data from a Theme, a .ascx WebControl or anywhere else.
History
- New in v13.02
- This is meant to replace the
ToSic.Sxc.Dnn.Factory. Please use this from now on.
Methods
App(NoParamOrder, int?, int?, ISite?, bool?)
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(...)
IApp App(NoParamOrder noParamOrder = default, int? zoneId = null, int? appId = null, ISite? site = null, bool? withUnpublished = null)
Parameters
noParamOrderNoParamOrderzoneIdint?The ZoneId of the App (optional)
appIdint?The AppId - REQUIRED
siteISiteSite information for further context (optional)
withUnpublishedbool?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
- 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.
IApp AppOfSite()
Returns
AppOfSite(NoParamOrder, int?, ISite?, bool?)
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(...)
IApp AppOfSite(NoParamOrder noParamOrder = default, int? siteId = null, ISite? overrideSite = null, bool? withUnpublished = null)
Parameters
noParamOrderNoParamOrdersiteIdint?The SiteId which is the PortalId in DNN. Optional - without it, the current Site / Portal is used.
overrideSiteISiteSite information for further context (optional)
withUnpublishedbool?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
- IApp
An initialized App object which you can use to access App.Data
OfApp(int)
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.
IDynamicCode12 OfApp(int appId)
Parameters
appIdintThe AppId
Returns
- IDynamicCode12
The dynamic code object for this App
OfApp(int, int)
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.
IDynamicCode12 OfApp(int zoneId, int appId)
Parameters
Returns
- 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.
IDynamicCode12 OfApp(IAppIdentity appIdentity)
Parameters
appIdentityIAppIdentityThe App Identifier
Returns
- IDynamicCode12
The dynamic code object for this App
OfModule(int, int)
Get a IDynamicCode12 object for a specific Module on a page
IDynamicCode12 OfModule(int pageId, int moduleId)
Parameters
Returns
OfSite()
Get a IDynamicCode12 object for the primary App of the current Site/Portal.
IDynamicCode12 OfSite()
Returns
OfSite(int)
Get a IDynamicCode12 object for a specific Site/Portal.
IDynamicCode12 OfSite(int siteId)
Parameters
siteIdint