Esempio n. 1
0
            Type LoadType()
            {
                if (type != null)
                {
                    return(type);
                }

                HttpContext context = HttpContext.Current;
                string      vpath;
                string      realpath;

                if (VirtualPathUtility.IsAppRelative(source))
                {
                    vpath    = source;
                    realpath = context.Request.MapPath(source);
                }
                else
                {
                    vpath    = VirtualPathUtility.ToAppRelative(source);
                    realpath = source;
                }

                if ((type = CachingCompiler.GetTypeFromCache(realpath)) != null)
                {
                    return(type);
                }

                type = BuildManager.GetCompiledType(vpath);
                if (type != null)
                {
                    AspGenerator.AddTypeToCache(null, realpath, type);
                    BuildManager.AddToReferencedAssemblies(type.Assembly);
                }
                return(type);
            }