Table of Contents

App and App Data Differences in APIs

2sxc has changed a lot over time. So you'll find old code snippets and new ones, and it helps to see which one is being used. Sometimes you'll also want to convert old code to new code, and this page should help you with that.

App and App Data Objects

Dynamic Code

In Dynamic Code, the objects you'll use are usually:

  • App - a IApp with all app data
  • App.Data - a IAppData with all app data

Typed Code

In Typed Code, the objects you'll use are usually:

Strong Typed Code

In Strong Typed Code - inheriting from AppCode.Razor.AppRazor, the objects you'll use are usually:

Differences in the App object (IApp vs. IAppTyped)

  • App.Query[...] is now App.GetQuery(...) - this will also allow for more advanced options in future
  • App.Folder is now a IFolder object
  • App.Path is replaced by App.Folder.Url
  • App.PathShared is replaced by App.FolderAdvanced(location: "shared").Url
  • App.PhysicalPath is replaced by App.Folder.PhysicalPath
  • App.PhysicalPathShared is replaced by App.FolderAdvanced(location: "shared").PhysicalPath
  • App.Thumbnail is now an IFile object
  • App.Thumbnail is replaced by App.Thumbnail.Url
  • MyView.Path still works, but you should use MyView.Folder.Url for clarity

Access App Data

Dynamic Typed Strong Typed
App
(IApp)
App
(IAppTyped)
App
(IAppTyped<TSet, TRes>)
App.Data
(IAppData)
App.Data
(IAppDataTyped)
App.Data
(IAppDataTyped)
App.Data["Tags"] App.Data["Tags"]
App.Data.GetStream("Tags") (recommended)
App.Data["Tags"]
App.Data.GetStream("Tags") (recommended)
App.Data.GetAll<T>()
App.Data.GetOne<T>(id)
App.Query("QName") App.GetQuery("QName") new method allows for more parameters App.GetQuery("QName") new method allows for more parameters
- App.GetQuery("QName", parameters: new { Id = 7 } ) App.GetQuery("QName", parameters: new { Id = 7 } )

Access App and View Folders / URLs

Dynamic Typed Strong Typed
- App.Folder
(IFolder) new only
App.Folder
(IFolder)
App.Folder
(string)
App.Folder.Name
(string)
App.Path App.Folder.Url
App.PhysicalPath App.Folder.PhysicalPath

Access App Settings

👉🏽 See Settings / Resources Differences in APIs