Dynamic Code API
Every C# file in 2sxc is Dynamic Code as it's compiled on-the-fly and has a lot of helpers to work with Dynamic Data.
The following APIs are available on all 2sxc Dynamic Code. You can use this in:
Discover More in the Razor TutorialsWe have an rich series of Razor tutorials. You should really check them out 👍.
Instance Data in Dynamic Code
The primary and often the only content-items for this template.
Can contain additional presentation settings for this content, like how to format it.
One or more Streams (lists) of zero-or-more content items
The header data if the template expects to be a list and also needs a title or intro.
Can contain additional presentation settings for the header, like how to format it.
App and App-Data Objects
The current App with
Pathinformation and more.
All the data of the current app for immediate use, fully cached in memory of the web server.
Queries which were created using VisualQuery and can be run to access prepared data.
Information about the system, page, module etc.
The common Dnn object providing page, module, user information
Helper providing you with various edit-functionality like
Helper to generate links, according to the DNN-environment configuration
Gives you the ADAM parts (files, images, folders) of a field.
- AsDynamic(...) - takes just about anything (an iEntity, a list of iEntities, a dynamic, ...) and casts it to a DynamicEntity
- AsEntity(...) - takes just about anything (iEntity, DynamicEntity, list of that) and casts it to an iEntity
Helper Commands provided by 2sxc
To create an object of a parsed CSHTML file, for example to then access methods of that code
Get a DataSource object of type
T(like filters, sorting, etc.)
- GetService<T>() Get a Service to help you (using Dependency Injection)
Your code must inherit the correct base class to get this API. You'll find the correct base classes in the documentations for Razor and Web API.