public DefaultControlBuilderFactory(RedwoodConfiguration configuration) { this.configuration = configuration; ViewCompilerFactory = () => configuration.ServiceLocator.GetService<IViewCompiler>(); markupFileLoader = configuration.ServiceLocator.GetService<IMarkupFileLoader>(); }
private void Init() { // touch assembly SyntaxFactory.Token(SyntaxKind.NullKeyword); InitOptions(); if (Options.FullCompile) if (!Directory.Exists(Options.OutputPath)) Directory.CreateDirectory(Options.OutputPath); var wsa = assemblyDictionary.GetOrAdd(Options.WebSiteAssembly, _ => Assembly.LoadFrom(Options.WebSiteAssembly)); configuration = GetCachedConfiguration(wsa, Options.WebSitePath); bindingCompiler = new AssemblyBindingCompiler(Options.BindingsAssemblyName, Options.BindingClassName, Path.Combine(Options.OutputPath, Options.BindingsAssemblyName + ".dll"), configuration); configuration.ServiceLocator.RegisterSingleton<IBindingCompiler>(() => bindingCompiler); configuration.ServiceLocator.RegisterSingleton<IControlResolver>(() => new OfflineCompilationControlResolver(configuration, this)); if (Options.DothtmlFiles == null) Options.DothtmlFiles = configuration.RouteTable.Select(r => r.VirtualPath).ToArray(); controlTreeResolver = configuration.ServiceLocator.GetService<IControlTreeResolver>(); fileLoader = configuration.ServiceLocator.GetService<IMarkupFileLoader>(); if (Options.FullCompile) { compiler = configuration.ServiceLocator.GetService<IViewCompiler>(); compilation = compiler.CreateCompilation(Options.AssemblyName); } if (Options.SerializeConfig) { result.Configuration = configuration; } // touch assemblies }
private void Init() { if (Options.FullCompile) { // touch assembly SyntaxFactory.Token(SyntaxKind.NullKeyword); InitOptions(); if (!Directory.Exists(Options.OutputPath)) { Directory.CreateDirectory(Options.OutputPath); } } var wsa = assemblyDictionary.GetOrAdd(Options.WebSiteAssembly, _ => Assembly.LoadFile(Options.WebSiteAssembly)); configuration = GetCachedConfiguration(wsa, Options.WebSitePath, (services) => { if (Options.FullCompile) { throw new NotImplementedException(); //TODO: LAST PARAMETER | bindingCompiler = new AssemblyBindingCompiler(Options.BindingsAssemblyName, Options.BindingClassName, Path.Combine(Options.OutputPath, Options.BindingsAssemblyName + ".dll"), null); services.AddSingleton <IBindingCompiler>(bindingCompiler); services.AddSingleton <IExpressionToDelegateCompiler>(bindingCompiler.GetExpressionToDelegateCompiler()); } }); if (Options.SerializeConfig) { result.Configuration = configuration; } if (Options.DothtmlFiles == null) { Options.DothtmlFiles = configuration.RouteTable.Select(r => r.VirtualPath).Where(r => !string.IsNullOrWhiteSpace(r)).ToArray(); } if (Options.FullCompile || Options.CheckBindingErrors) { compiledAssemblyCache = configuration.ServiceProvider.GetService <CompiledAssemblyCache>(); controlTreeResolver = configuration.ServiceProvider.GetService <IControlTreeResolver>(); fileLoader = configuration.ServiceProvider.GetService <IMarkupFileLoader>(); } if (Options.FullCompile) { compiler = configuration.ServiceProvider.GetService <IViewCompiler>(); compilation = compiler.CreateCompilation(Options.AssemblyName); } }
private void Init() { if (Options.FullCompile) { // touch assembly SyntaxFactory.Token(SyntaxKind.NullKeyword); InitOptions(); if (!Directory.Exists(Options.OutputPath)) { Directory.CreateDirectory(Options.OutputPath); } } var wsa = assemblyDictionary.GetOrAdd(Options.WebSiteAssembly, _ => Assembly.LoadFile(Options.WebSiteAssembly)); AssemblyResolver.LoadReferences(wsa); configuration = GetCachedConfiguration(wsa, Options.WebSitePath, (services) => { if (Options.FullCompile) { services.AddSingleton <IBindingCompiler>(s => bindingCompiler = new AssemblyBindingCompiler(Options.BindingsAssemblyName, Options.BindingClassName, Path.Combine(Options.OutputPath, Options.BindingsAssemblyName + ".dll"), s.GetRequiredService <DotvvmConfiguration>())); } }); if (Options.DothtmlFiles == null || !Options.DothtmlFiles.Any()) { Options.DothtmlFiles = configuration.RouteTable.Select(r => r.VirtualPath).ToArray(); } if (Options.FullCompile) { controlTreeResolver = configuration.ServiceProvider.GetRequiredService <IControlTreeResolver>(); fileLoader = configuration.ServiceProvider.GetRequiredService <IMarkupFileLoader>(); compiler = configuration.ServiceProvider.GetRequiredService <IViewCompiler>(); compilation = compiler.CreateCompilation(Options.AssemblyName); } if (Options.SerializeConfig) { result.Configuration = configuration; } }
public DefaultControlBuilderFactory(DotvvmConfiguration configuration) { for (int i = 0; i < compilationLocks.Length; i++) { compilationLocks[i] = new object(); } this.configuration = configuration; ViewCompilerFactory = () => configuration.ServiceLocator.GetService<IViewCompiler>(); markupFileLoader = configuration.ServiceLocator.GetService<IMarkupFileLoader>(); if (configuration.CompiledViewsAssemblies != null) foreach (var assembly in configuration.CompiledViewsAssemblies) { LoadCompiledViewsAssembly(assembly); } }
public DefaultControlBuilderFactory(DotvvmConfiguration configuration) { for (int i = 0; i < compilationLocks.Length; i++) { compilationLocks[i] = new object(); } this.configuration = configuration; ViewCompilerFactory = () => configuration.ServiceLocator.GetService<IViewCompiler>(); markupFileLoader = configuration.ServiceLocator.GetService<IMarkupFileLoader>(); if (configuration.CompiledViewsAssemblies != null) foreach (var assembly in configuration.CompiledViewsAssemblies) { LoadCompiledViewsAssembly(assembly); } }
private void Init() { // touch assembly SyntaxFactory.Token(SyntaxKind.NullKeyword); InitOptions(); if (Options.FullCompile) { if (!Directory.Exists(Options.OutputPath)) { Directory.CreateDirectory(Options.OutputPath); } } var wsa = assemblyDictionary.GetOrAdd(Options.WebSiteAssembly, _ => Assembly.LoadFrom(Options.WebSiteAssembly)); configuration = GetCachedConfiguration(wsa, Options.WebSitePath); bindingCompiler = new AssemblyBindingCompiler(Options.BindingsAssemblyName, Options.BindingClassName, Path.Combine(Options.OutputPath, Options.BindingsAssemblyName + ".dll"), configuration); configuration.ServiceLocator.RegisterSingleton <IBindingCompiler>(() => bindingCompiler); configuration.ServiceLocator.RegisterSingleton <IControlResolver>(() => new OfflineCompilationControlResolver(configuration, this)); if (Options.DothtmlFiles == null) { Options.DothtmlFiles = configuration.RouteTable.Select(r => r.VirtualPath).ToArray(); } controlTreeResolver = configuration.ServiceLocator.GetService <IControlTreeResolver>(); fileLoader = configuration.ServiceLocator.GetService <IMarkupFileLoader>(); if (Options.FullCompile) { compiler = configuration.ServiceLocator.GetService <IViewCompiler>(); compilation = compiler.CreateCompilation(Options.AssemblyName); } if (Options.SerializeConfig) { result.Configuration = configuration; } // touch assemblies }
public DefaultDotvvmViewBuilder(IMarkupFileLoader markupFileLoader, IControlBuilderFactory builderFactory) { this.markupFileLoader = markupFileLoader; this.controlBuilderFactory = builderFactory; }
public VirtualMarkupFileLoader(IMarkupFileLoader fallback) { this.fallback = fallback; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultDotvvmViewBuilder"/> class. /// </summary> public DefaultDotvvmViewBuilder(DotvvmConfiguration configuration) { markupFileLoader = configuration.ServiceLocator.GetService <IMarkupFileLoader>(); controlBuilderFactory = configuration.ServiceLocator.GetService <IControlBuilderFactory>(); }
public DefaultDotvvmViewBuilder(IMarkupFileLoader markupFileLoader, IControlBuilderFactory builderFactory, DotvvmMarkupConfiguration markupConfiguration) { this.markupConfiguration = markupConfiguration; this.markupFileLoader = markupFileLoader; this.controlBuilderFactory = builderFactory; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultDotvvmViewBuilder"/> class. /// </summary> public DefaultDotvvmViewBuilder(DotvvmConfiguration configuration) { markupFileLoader = configuration.ServiceLocator.GetService<IMarkupFileLoader>(); controlBuilderFactory = configuration.ServiceLocator.GetService<IControlBuilderFactory>(); }