Where Data Comes From
From a developer perspective you have three kinds of Data:
In addition you have Settings and Resources:
And you have Context information:
- MyContext / CmsContext
- MyPage
- MyUser
- MyView
- etc.
App Data
The complete App Data is always available in these objects:
- App
The current App withSettings
,Resources
,Path
information and more. - App.Data
All the data of the current app for immediate use, fully cached in memory of the web server. - App.Query
Queries which were created using VisualQuery and can be run to access prepared data.
Instance Data
Note
Instance specific data belongs to the module-instance on the page, either because it was added manually as Content or because the View of the module-instance uses a Query.
Best read about App vs. Instance Data and Where Data Comes From
If the View is configured for manual content-editing or uses a Query then Instance Data is automatically prepared in these objects:
- Content
The primary and often the only content-items for this template. - Content.Presentation
Can contain additional presentation settings for this content, like how to format it. - Data
One or more Streams (lists) of zero-or-more content items - Header
The header data if the template expects to be a list and also needs a title or intro. - Header.Presentation
Can contain additional presentation settings for the header, like how to format it.
Code Retrieved Data
Your code can also retrieve data using normal C# code to do things like
- Get lists of files from ADAM or the file system
- Read data from SQL
- Manually parse CSV files or access external Web Services
- Use DataSources to get SQL, CSV or other data
Configuration and Settings
Configuration is usually found on specific objects which are configured. There are three types:
- View Configuration
- App Configuration
- Feature activations
Settings usually affect templates / Razor or C# WebAPIs. They are usually configured at various levels like on the View, App, Site or Global.
C# code will usually get these settings from the Settings
object which consolidates all the settings.
👉 See Settings
Resources
Resources are meant to provide translated labels, logos etc. You can configure them at View, App, Site or Global level.
👉 See Resources
History
- Introduced in 2sxc v1
- App.Data added ca. 2sxc 6
- App.Query added ca. 2sxc 7
- Settings and Resources added in 2sxc 12