Exemplo n.º 1
0
 public ViewCompilingVisitor(DefaultViewCompilerCodeEmitter emitter, CompiledAssemblyCache compiledAssemblyCache, IBindingCompiler bindingCompiler,
                             string className)
 {
     this.emitter = emitter;
     this.compiledAssemblyCache = compiledAssemblyCache;
     this.className             = className;
     this.bindingCompiler       = bindingCompiler;
 }
Exemplo n.º 2
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

#if DotNetCore
            System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Instance.DefaultOnResolving;
#else
            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
#endif
        }
Exemplo n.º 3
0
 public virtual TypeRegistry AddImportedTypes(TypeRegistry reg, CompiledAssemblyCache compiledAssemblyCache)
 {
     if (ImportNamespaces != null)
     {
         return(reg.AddSymbols(ImportNamespaces.Select(ns => CreateTypeLoader(ns, compiledAssemblyCache))));
     }
     else
     {
         return(reg);
     }
 }
Exemplo n.º 4
0
 public DefaultViewCompiler(IOptions <ViewCompilerConfiguration> config, IControlTreeResolver controlTreeResolver, IBindingCompiler bindingCompiler, Func <Validation.ControlUsageValidationVisitor> controlValidatorFactory, CompiledAssemblyCache compiledAssemblyCache)
 {
     this.config = config.Value;
     this.controlTreeResolver     = controlTreeResolver;
     this.bindingCompiler         = bindingCompiler;
     this.controlValidatorFactory = controlValidatorFactory;
     this.assemblyCache           = compiledAssemblyCache;
 }
Exemplo n.º 5
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
        }
Exemplo n.º 6
0
 private static Func <string, Expression> CreateTypeLoader(NamespaceImport import, CompiledAssemblyCache compiledAssemblyCache)
 {
     if (import.HasAlias)
     {
         return t => {
                    if (t.Length >= import.Alias.Length && t.StartsWith(import.Alias, StringComparison.Ordinal))
                    {
                        string name;
                        if (t == import.Alias)
                        {
                            name = import.Namespace;
                        }
                        else if (t.Length > import.Alias.Length + 1 && t[import.Alias.Length] == '.')
                        {
                            name = import.Namespace + "." + t.Substring(import.Alias.Length + 1);
                        }
                        else
                        {
                            return null;
                        }
                        return TypeRegistry.CreateStatic(compiledAssemblyCache.FindType(name));
                    }
                    else
                    {
                        return null;
                    }
         }
     }
     ;
     else
     {
         return(t => TypeRegistry.CreateStatic(compiledAssemblyCache.FindType(import.Namespace + "." + t)));
     }
 }
Exemplo n.º 7
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
        }