private static void PrecompileViews(SparkViewFactory viewFactory) { var batch = new SparkBatchDescriptor(); batch .For<HomeController>(); viewFactory.Precompile(batch); }
public void Compile(Assembly sourceAsm) { var sparkViewFactory = new SparkViewFactory(GetSparkSettings()) { ViewFolder = new FileSystemViewFolder(EnsureDirectoryExists(_arguments.Views)) }; var batch = new SparkBatchDescriptor(GetOutputDllFullPath()); batch.FromAssembly(sourceAsm); DescribeSparkViews(batch, sourceAsm); DescribeCustomSparkViews(batch, sourceAsm); sparkViewFactory.DescriptorBuilder = new AutoMasterDescriptorBuilder(sparkViewFactory.Engine); try { sparkViewFactory.Precompile(batch); } catch (CompilerException e) { File.WriteAllText("arq.CompilerException.txt", e.Message); throw new CompilerException(e.Message.FirstLine() + "\nSee arq.CompilerException.txt for full description"); } }
protected void Application_Start() { var builder = new ContainerBuilder(); builder.RegisterControllers(Assembly.GetExecutingAssembly()).PropertiesAutowired(); builder.RegisterModelBinders(Assembly.GetExecutingAssembly()); builder.RegisterModule<DomainModule>(); builder.RegisterModule<MessagingModule>(); builder.RegisterModule<ServicesModule>(); builder.RegisterModule<SourceControlModule>(); _containerProvider = new ContainerProvider(builder.Build()); ControllerBuilder.Current.SetControllerFactory(new AutofacControllerFactory(_containerProvider)); var batch = new SparkBatchDescriptor(); batch.For<AccountController>() .For<DashboardController>() .For<ProjectController>(); var viewFactory = new SparkViewFactory(); viewFactory.Precompile(batch); ViewEngines.Engines.Add(viewFactory); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); //RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); }