Table of Contents

CmsContext in Dynamic Code ✨ new!

To enable Hybrid Razor which works on Dnn and Oqtane, we need standards so that our Dynamic Code can access information about the page, module etc. Up until now our code always used the Dnn object which obviously doesn't on Oqtane and other platforms.

So we're creating this new standardized object to ask for these things.

⚡ The official API docs of the Object on the Dynamic Code

⚡ The official API docs of the ICmsContext object

Discover More in the Razor Tutorials

We have an rich series of Razor tutorials. You should really check them out 👍.


CmsContext.Platform

Information about the platform the system is running on. Usually Dnn or Oqtane.

Name Type Value Example Description
Type PlatformType PlatformType.Dnn
Name string Dnn

👉 ICmsPlatform

CmsContext.Culture

Culture information for the current request.

Name Type Value Example Description
DefaultCode string en-us The default language code of the site
CurrentCode string de-ch Primary language code for the site

👉 ICmsCulture

CmsContext.Site

Name Type Value Example Description
Id int 2 Site ID
Url string 2sxc.org Primary site url without protocol

👉 ICmsSite

CmsContext.Page

Name Type Value Example Description
Id int 36 Page ID
Parameters IDictionary<string, string> Use as cross-platform Query params

👉 ICmsPage

CmsContext.Module

Name Type Value Example Description
Id int 5030 Module ID

👉 ICmsModule

CmsContext.User

Name Type Value Example Description
Id int 2 User ID
IsSiteAdmin bool true People who can can admin users/content
IsSystemAdmin bool true Super Users
IsSiteDeveloper bool true Usually just Super-Users

👉 ICmsSite

CmsContext.View new in 12.02

Name Type Value Example Description
Id int 2 View ID
Edition string bs4 Polymorphism edition if used, otherwise empty
Name string 4 Tiles Name of the view
Identity string BLUE Custom identity like name, but language invariant

👉 ICmsView

You should find some code examples in this demo App

  • No demo apps exist yet

History

  1. Introduced in 2sxc 11.11
  2. CmsContext.Page.Parameters added in 2sxc 12.0
  3. CmsContext.View added in 2sxc 12.02 with all the new features