コード例 #1
0
 public ViewCompilingVisitor(DefaultViewCompilerCodeEmitter emitter, CompiledAssemblyCache compiledAssemblyCache, IBindingCompiler bindingCompiler,
                             string className)
 {
     this.emitter = emitter;
     this.compiledAssemblyCache = compiledAssemblyCache;
     this.className             = className;
     this.bindingCompiler       = bindingCompiler;
 }
コード例 #2
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

#if DotNetCore
            System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Instance.DefaultOnResolving;
#else
            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
#endif
        }
コード例 #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);
     }
 }
コード例 #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;
 }
コード例 #5
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

            AppDomain.CurrentDomain.AssemblyResolve += Instance.TryResolveAssembly;
        }
コード例 #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)));
     }
 }
コード例 #7
0
        static CompiledAssemblyCache()
        {
            Instance = new CompiledAssemblyCache();

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