T4Scaffolding.Cmdlets.InvokeScaffoldTemplateCmdlet.PreprocessTemplateContent C# (CSharp) Method

PreprocessTemplateContent() private static method

private static PreprocessTemplateContent ( string templateContent ) : string
templateContent string
return string
        private static string PreprocessTemplateContent(string templateContent)
        {
            // To eliminate the direct reference to Microsoft.VisualStudio.TextTemplating.10.0.dll, we need to eliminate the
            // DynamicTransform base class which previously provided a "Model" property. As a replacement for this, automatically
            // append a T4 "class feature" to the template file that contains a "Model" property, and automatically remove any
            // inheritance reference to "DynamicTransform"
            templateContent = templateContent ?? string.Empty;

            // Eliminate Inherits="DynamicTransform" from template directive
            templateContent = Regex.Replace(templateContent, @"\<\#\@\s*\bTemplate\b(.*?\b)?Inherits=""DynamicTransform""\s*(.*?)\#\>", @"<#@ Template $1 $2 #>", RegexOptions.Singleline | RegexOptions.IgnoreCase);

            // Append "Model" property
            var language = DetermineLanguageForTemplate(templateContent);
            templateContent += ModelPropertyClassFeatures.ModelPropertySourceForLanguage[language];

            return templateContent;
        }