Esempio n. 1
0
        public static void Install(ControllerBuilder builder)
        {
            if (ViewFormats.Count == 0)
            {
                throw new InvalidOperationException(
                          "You must enable at least one set of view locations or add your own."
                          );
            }

            if (FileExtensions.Count == 0)
            {
                FileExtensions.Add("cshtml");
                FileExtensions.Add("vbhtml");
            }

            var engine = new EnhancedViewLocationsViewEngine();

            engine.SetFullViewFormats(ViewFormats);
            engine.SetPartialViewFormats(ViewFormats);
            engine.SetFileExtensions(FileExtensions);

            ViewEngines.Engines.Insert(0, engine);
        }
        public static void Install(ControllerBuilder builder)
        {
            if ( ViewFormats.Count == 0 )
            {
                throw new InvalidOperationException(
                    "You must enable at least one set of view locations or add your own."
                    );
            }

            if ( FileExtensions.Count == 0 )
            {
                FileExtensions.Add( "cshtml" );
                FileExtensions.Add( "vbhtml" );
            }

            var engine = new EnhancedViewLocationsViewEngine();
            engine.SetFullViewFormats( ViewFormats );
            engine.SetPartialViewFormats( ViewFormats );
            engine.SetFileExtensions( FileExtensions );

            ViewEngines.Engines.Insert( 0, engine );
        }