public override void Initialize( RazorPageHost razorHost, IDictionary<string, string> directives )
        {
            base.Initialize( razorHost, directives );
    
            var path = razorHost.EnableLinePragmas ? razorHost.File.RealPath : string.Empty;
            razorHost.CodeGenerator = new CSharpRazorCodeGenerator( razorHost.DefaultClassName, razorHost.DefaultNamespace, path, razorHost )
                {
                    GenerateLinePragmas = razorHost.EnableLinePragmas
                };

        }
Esempio n. 2
0
        public override void Initialize(RazorPageHost razorHost, IDictionary<string, string> directives)
        {
            base.Initialize(razorHost, directives);

            // Remove the extension and replace path separator slashes with underscores
            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(razorHost.File.VirtualPath);

            // If its a PageStart page, set the base type to StartPage.
            if (fileNameWithoutExtension.Equals("_pagestart", StringComparison.OrdinalIgnoreCase))
            {
//                razorHost.DefaultBaseClass = typeof(System.Web.WebPages.StartPage).FullName;
            }
        }
        public override void Initialize(RazorPageHost razorHost, IDictionary<string, string> directives)
        {
            base.Initialize(razorHost, directives);
            //razorHost.DefaultBaseClass = typeof(System.Web.WebPages.HelperPage).FullName;

            //razorHost.GeneratedClassContext = new GeneratedClassContext(
            //        executeMethodName: GeneratedClassContext.DefaultExecuteMethodName,
            //        writeMethodName: GeneratedClassContext.DefaultWriteMethodName,
            //        writeLiteralMethodName: GeneratedClassContext.DefaultWriteLiteralMethodName,
            //        writeToMethodName: WriteToMethodName,
            //        writeLiteralToMethodName: WriteLiteralToMethodName,
            //        templateTypeName: typeof(System.Web.WebPages.HelperResult).FullName,
            //        defineSectionMethodName: "DefineSection"
            //);
        }
Esempio n. 4
0
        public override void Initialize(RazorPageHost razorHost, IDictionary<string, string> directives)
        {
            base.Initialize(razorHost, directives);


            string baseClass = razorHost.DefaultBaseClass;
            _isSpecialPage = IsSpecialPage(razorHost.File.VirtualPath);

            // The CSharpRazorCodeGenerator decides to generate line pragmas based on if the file path is available. Set it to an empty string if we 
            // do not want to generate them.
            string path = razorHost.EnableLinePragmas ? razorHost.File.RealPath : String.Empty;
            razorHost.CodeGenerator = new CSharpRazorCodeGenerator(razorHost.DefaultClassName, razorHost.DefaultNamespace, path, razorHost);
            razorHost.CodeGenerator.GenerateLinePragmas = razorHost.EnableLinePragmas;
//            razorHost.Parser = new MvcCSharpRazorCodeParser();
        }