Esempio n. 1
0
        public static CompilerResults Compile(WebServiceCompiler compiler)
        {
            string          key     = cachePrefix + compiler.Parser.PhysicalPath;
            Cache           cache   = HttpRuntime.InternalCache;
            CompilerResults results = (CompilerResults)cache [key];

            if (results != null)
            {
                return(results);
            }

            object ticket;
            bool   acquired = AcquireCompilationTicket(key, out ticket);

            try {
                Monitor.Enter(ticket);
                results = (CompilerResults)cache [key];
                if (results != null)
                {
                    return(results);
                }

#if NET_2_0
                CodeDomProvider comp = compiler.Provider;
#else
                ICodeCompiler comp = compiler.Compiler;
#endif
                CompilerParameters options = compiler.CompilerParameters;

                GetExtraAssemblies(options);

                results = comp.CompileAssemblyFromFile(options, compiler.InputFile);
                string [] deps = (string [])compiler.Parser.Dependencies.ToArray(typeof(string));
                cache.Insert(key, results, new CacheDependency(deps));
            } finally {
                Monitor.Exit(ticket);
                if (acquired)
                {
                    ReleaseCompilationTicket(key);
                }
            }

            return(results);
        }
		public static CompilerResults Compile (WebServiceCompiler compiler)
		{
			string key = cachePrefix + compiler.Parser.PhysicalPath;
			Cache cache = HttpRuntime.Cache;
			CompilerResults results = (CompilerResults) cache [key];
			if (results != null)
				return results;

			lock (compilationLock) {
				results = (CompilerResults) cache [key];
				if (results != null)
					return results;

				SimpleWebHandlerParser parser = compiler.Parser;
				CompilerParameters options = compiler.CompilerOptions;
				options.IncludeDebugInformation = parser.Debug;
				results = compiler.Compiler.CompileAssemblyFromFile (options, compiler.InputFile);
				string [] deps = (string []) parser.Dependencies.ToArray (typeof (string));
				cache.InsertPrivate (key, results, new CacheDependency (deps));
			}

			return results;
		}
		public static Type CompileIntoType (SimpleWebHandlerParser wService)
		{
			WebServiceCompiler wsc = new WebServiceCompiler (wService);
			return wsc.GetCompiledType ();
		}
Esempio n. 4
0
        public static Type CompileIntoType(SimpleWebHandlerParser wService)
        {
            WebServiceCompiler wsc = new WebServiceCompiler(wService);

            return(wsc.GetCompiledType());
        }
Esempio n. 5
0
		public static CompilerResults Compile (WebServiceCompiler compiler)
		{
			string key = cachePrefix + compiler.Parser.PhysicalPath;
			Cache cache = HttpRuntime.InternalCache;
			CompilerResults results = (CompilerResults) cache [key];
			if (results != null)
				return results;

			object ticket;
			bool acquired = AcquireCompilationTicket (key, out ticket);

			try {
				Monitor.Enter (ticket);
				results = (CompilerResults) cache [key];
				if (results != null)
					return results;

				CodeDomProvider comp = compiler.Provider;
				CompilerParameters options = compiler.CompilerParameters;

				GetExtraAssemblies (options);
				
				results = comp.CompileAssemblyFromFile (options, compiler.InputFile);
				string [] deps = (string []) compiler.Parser.Dependencies.ToArray (typeof (string));
				cache.Insert (key, results, new CacheDependency (deps));
			} finally {
				Monitor.Exit (ticket);
				if (acquired)
					ReleaseCompilationTicket (key);
			}

			return results;
		}