Table of Contents

Class Factory

Namespace
ToSic.Sxc.Dnn
Assembly
ToSic.Sxc.Dnn.Core.dll

This is a factory to create CmsBlocks, Apps etc. and related objects from DNN.

Warning

This API is obsolete and will be removed in a future release. You should migrate your code to use real services instead, like:

[PublicApi]
[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static class Factory
Inheritance
object
Factory

Methods

App(int, PortalSettings, bool, bool, ILog)

Get a full app-object for accessing data of the app from outside

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IApp App(int appId, PortalSettings ownerPortalSettings, bool unusedButKeepForApiStability = false, bool showDrafts = false, ILog parentLog = null)

Parameters

appId int

The AppID of the app you need

ownerPortalSettings PortalSettings

The owner portal - this is important when retrieving Apps from another portal.

unusedButKeepForApiStability bool

Tells the App that you'll be using page-publishing. So changes will me auto-drafted for a future release as the whole page together.

showDrafts bool

Show draft items - usually false for visitors, true for editors/admins.

parentLog ILog

optional logger to attach to

Returns

IApp

An initialized App object which you can use to access App.Data

App(int, bool, bool, ILog)

Get a full app-object for accessing data of the app from outside

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IApp App(int appId, bool unusedButKeepForApiStability = false, bool showDrafts = false, ILog parentLog = null)

Parameters

appId int

The AppID of the app you need

unusedButKeepForApiStability bool

Tells the App that you'll be using page-publishing. So changes will me auto-drafted for a future release as the whole page together.

showDrafts bool

Show draft items - usually false for visitors, true for editors/admins.

parentLog ILog

optional logger to attach to

Returns

IApp

An initialized App object which you can use to access App.Data

App(int, int, bool, bool, ILog)

Get a full app-object for accessing data of the app from outside

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IApp App(int zoneId, int appId, bool unusedButKeepForApiStability = false, bool showDrafts = false, ILog parentLog = null)

Parameters

zoneId int

The zone the app is in.

appId int

The AppID of the app you need

unusedButKeepForApiStability bool

Tells the App that you'll be using page-publishing. So changes will me auto-drafted for a future release as the whole page together.

showDrafts bool

Show draft items - usually false for visitors, true for editors/admins.

parentLog ILog

optional logger to attach to

Returns

IApp

An initialized App object which you can use to access App.Data

CmsBlock(ModuleInfo)

Get a Root CMS Block if you have the ModuleInfo object

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IBlockBuilder CmsBlock(ModuleInfo moduleInfo)

Parameters

moduleInfo ModuleInfo

A DNN ModuleInfo object

Returns

IBlockBuilder

An initialized CMS Block, ready to use/render

CmsBlock(int, int)

Get a Root CMS Block if you know the TabId and the ModId

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IBlockBuilder CmsBlock(int pageId, int modId)

Parameters

pageId int

The DNN tab id (page id)

modId int

The DNN Module id

Returns

IBlockBuilder

An initialized CMS Block, ready to use/render

CmsBlock(int, int, ILog)

Get a Root CMS Block if you know the TabId and the ModId

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IBlockBuilder CmsBlock(int pageId, int modId, ILog parentLog)

Parameters

pageId int

The DNN tab id (page id)

modId int

The DNN Module id

parentLog ILog

The parent log, optional

Returns

IBlockBuilder

An initialized CMS Block, ready to use/render

CmsBlock(IModule, ILog)

Get a Root CMS Block if you have the ModuleInfo object.

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IBlockBuilder CmsBlock(IModule module, ILog parentLog = null)

Parameters

module IModule
parentLog ILog

optional logger to attach to

Returns

IBlockBuilder

An initialized CMS Block, ready to use/render

DynamicCode(IBlockBuilder)

Retrieve a helper object which provides commands like AsDynamic, AsEntity etc.

[Obsolete("This is obsolete in V13 but will continue to work for now, we plan to remove in v15 or 16. Use the IDynamicCodeService or the IRenderService instead.")]
public static IDnnDynamicCode DynamicCode(IBlockBuilder blockBuilder)

Parameters

blockBuilder IBlockBuilder

CMS Block for which the helper is targeted.

Returns

IDnnDynamicCode

A Code Helper based on IDnnDynamicCode