Class RazorTemplateConverter
- Namespace
- Dynamicweb.Rendering
- Assembly
- Dynamicweb.Core.dll
Analyzes and convert razor templates in C# from .net framework to .net core versions.
- Converts HttpContext to use Dynamicweb.Context
- Removes @using System.Web statements
- Converts @Helper signatures to voids inside @functions blocks
- Converts all calls to helpers @MyHelper() to method calls @{MyHelper();}
public class RazorTemplateConverter
- Inheritance
-
RazorTemplateConverter
- Inherited Members
Constructors
RazorTemplateConverter()
Instantiates a new template conversion instance
public RazorTemplateConverter()
Methods
ConversionResult()
Returns a the result of a conversion that explains the changes that was made
public string ConversionResult()
Returns
ConvertTemplate()
Converts a the loaded template to new format replacing system.web, httpcontext, changing helper definitions and helper calls.
public string ConvertTemplate()
Returns
- string
A string containing the result of the conversion. The result has to be saved into a new template file.
HelperCallConvert()
Converts all helper calls in templates where the helper is defined inanother template (i.e. an include)
public string HelperCallConvert()
Returns
HelperCallCount()
Count all instances of calls to helpers
public int HelperCallCount()
Returns
HelperDefinitionConvert()
Converts all helper definitions in a template and the calls to that helper in the same template
public string HelperDefinitionConvert()
Returns
- string
A string containing the parsed version of the template where helper definitions have been changed to new format
HelperDefinitionCount()
Counts all instances of a helpers defined in a template file
public int HelperDefinitionCount()
Returns
LoadFromString(string)
Load template content from string
public void LoadFromString(string templateMarkup)
Parameters
templateMarkup
stringA fully loaded template where includes and masters have been resolved and merged into the cshtml template document - i.e. what can be found in _parsed folder or templates that does not use include or master templates
LoadFromTemplate(string)
Load template content from file
public void LoadFromTemplate(string fullTemplatePath)
Parameters
fullTemplatePath
stringA fully qualified path to a template file that needs to be converted. If the template contains includes or master files, they are first read and merged before the original template is converted
SaveOverwriteExistingTemplate()
Saves the converted template the original file where the template was loaded from.
public void SaveOverwriteExistingTemplate()
Exceptions
SaveOverwriteExistingTemplateWithBackup()
Saves the converted template the original file where the template was loaded from.
public void SaveOverwriteExistingTemplateWithBackup()
Exceptions
SaveToDw10Template()
Saves the converted template to {templateName}.dw10.cshtml
public void SaveToDw10Template()
Exceptions
SaveToTemplate(string)
Saves converted template to the specified fully qualified path
public void SaveToTemplate(string fullPath)
Parameters
fullPath
string
SystemWebConvert()
Convert all instances of calls to HttpContext.Current to Dynamicweb.Context and also removes System.Web using statements
public string SystemWebConvert()
Returns
SystemWebCount()
Counts all instances of System.web references and uses of HttpContext
public int SystemWebCount()