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.
[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
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
noParamOrder
NoParamOrderzoneId
int?The ZoneId of the App (optional)
appId
int?The AppId - REQUIRED
site
ISiteSite information for further context (optional)
withUnpublished
bool?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 site = null, bool? withUnpublished = null)
Parameters
noParamOrder
NoParamOrdersiteId
int?The SiteId which is the PortalId in DNN. Optional - without it, the current Site / Portal is used.
site
ISiteSite information for further context (optional)
withUnpublished
bool?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
appId
intThe 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
appIdentity
IAppIdentityThe 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
siteId
int