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:
Typed Code
In Typed Code, the objects you'll use are usually:
App
- a IAppTyped with all app dataApp.Data
- a IAppDataTyped with all app data
Strong Typed Code
In Strong Typed Code - inheriting from AppCode.Razor.AppRazor
, the objects you'll use are usually:
App
- a IAppTyped<TSet, TRes> with all app dataApp.Data
- a IAppData with all app data
Differences in the App object (IApp
vs. IAppTyped
)
App.Query[...]
is nowApp.GetQuery(...)
- this will also allow for more advanced options in futureApp.Folder
is now aIFolder
objectApp.Path
is replaced byApp.Folder.Url
App.PathShared
is replaced byApp.FolderAdvanced(location: "shared").Url
App.PhysicalPath
is replaced byApp.Folder.PhysicalPath
App.PhysicalPathShared
is replaced byApp.FolderAdvanced(location: "shared").PhysicalPath
App.Thumbnail
is now an IFile objectApp.Thumbnail
is replaced byApp.Thumbnail.Url
MyView.Path
still works, but you should useMyView.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