Razor Basics
- Change all base classes of Razor to
Custom.Hybrid.Razor12
- Change all .cs files which need context to inherit
Custom.Hybrid.Code12
- Change @RenderPage to @Html.Partial
- To get values in the sub-page, use DynamicModel.property, not PageData["property"]
- ...
Remove all inline or external @helper sections
The @helper isn't supported in Razor. If you have them in the primary file, just replace with a function.
- Replace all helpers to be functions returning dynamic.
- Put into a
@functions { }
block
- Build the content using RazorBlade with Tag.Div(...) and similar. To return a complex html which was a string first, put it into Tag.Custom(string).
If you have a .cshtml library, you will...
- either split the library into many .cshtml files
- or create a .cs shared class with functions (Oqtane doesn't support .cshtml as code)
Koi
- Change all cases of Koi to use
GetService<Connect.Koi.ICss>()
instead of the global static object. See example in content-app.
- Replace the KOI warnings to use the texts stored in Koi (see content-app)
Dnn Object and DotNetNuke Namespace
- Convert everything
Activate JS
Including JS works just like before, but starting it is different. Make sure your code differentiates between general init functions (which should run automatically once on $(...) and code which activates HTML - which should be a function and called from Html once ready. See examples in fancybox and content-app.
- Reorg code
- Ensure primary init happens automatically
- Ensure activation is a function called by the page
- Make sure that if activation is called multiple times, it doesn't break stuff
- Anything that uses animations must be tested against Oqtane, as it only has jQuery slim and may need some monkey-patching
Special Cases
- In some Razors we're still returning a file - like an RSS xml or something. This must be moved to a WebApi and linked to using Link.Api(path: "api/rss?id=") or similar