Esempio 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;
 }
Esempio 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
        }
Esempio 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);
     }
 }
Esempio 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;
 }
Esempio n. 5
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
        }
Esempio 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)));
     }
 }
Esempio n. 7
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

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