public object Create(object parent, object configContext, XmlNode section)
        {
			bool? debug = null;
			bool? inMemory = null;
			bool? autoRecompilation = null;
			string temporarySourceFilesDirectory = null;
			bool? saveFiles = null;
        	string referencesPath = null;
        	string generatedAssemblyName = null;
			List<ReferencedAssembly> references = new List<ReferencedAssembly>();
			string actionExtension = null;

			if (section.Attributes["debug"] != null)
				debug = bool.Parse(section.Attributes["debug"].Value);
			if (section.Attributes["inMemory"] != null)
				inMemory = bool.Parse(section.Attributes["inMemory"].Value);
			if (section.Attributes["autoRecompilation"] != null)
				autoRecompilation = bool.Parse(section.Attributes["autoRecompilation"].Value);
			if (section.Attributes["temporarySourceFilesDirectory"] != null)
				temporarySourceFilesDirectory = section.Attributes["temporarySourceFilesDirectory"].Value;
			if (section.Attributes["saveFiles"] != null)
				saveFiles = bool.Parse(section.Attributes["saveFiles"].Value);
			if (section.Attributes["referencesPath"] != null)
				referencesPath = section.Attributes["referencesPath"].Value;
			if (section.Attributes["generatedAssemblyNamePrefix"] != null)
				generatedAssemblyName = section.Attributes["generatedAssemblyNamePrefix"].Value;

			foreach (XmlNode reference in section.SelectNodes("reference"))
			{
				string name = reference.Attributes["assembly"].Value;
				ReferencedAssembly.AssemblySource source = ReferencedAssembly.AssemblySource.BinDirectory;
				if (reference.Attributes["isFromGac"] != null)
					if (reference.Attributes["isFromGac"].Value.Equals("true", StringComparison.InvariantCultureIgnoreCase))
						source = ReferencedAssembly.AssemblySource.GlobalAssemblyCache;
				references.Add(new ReferencedAssembly(name, source));
			}

			AspViewCompilerOptions compilerOptions = new AspViewCompilerOptions(
				debug, inMemory, autoRecompilation, temporarySourceFilesDirectory, saveFiles, referencesPath, generatedAssemblyName, references);

			if (section.Attributes["actionExtension"] != null)
			{
				actionExtension = section.Attributes["actionExtension"].Value;
				if (actionExtension[0] != '.')
					actionExtension = "." + actionExtension;
			}

			AspViewEngineOptions options = new AspViewEngineOptions(actionExtension, compilerOptions);

            return options;
        }
Beispiel #2
0
        public object Create(object parent, object configContext, XmlNode section)
        {
            if (section == null)
            {
                throw new AspViewException("AspView config section is missing or not found");
            }

            IEnumerable <ReferencedAssembly> references = GetReferencesFrom(section);

            IDictionary <Type, Type> providers = GetProviders(section);

            AspViewCompilerOptions compilerOptions = GetCompilerOptionsFrom(section, references, providers);

            AspViewEngineOptions options = new AspViewEngineOptions(compilerOptions);

            return(options);
        }
Beispiel #3
0
        public object Create(object parent, object configContext, XmlNode section)
        {
            if (section == null)
            {
                throw new ApplicationException("AspView config section is missing or not found");
            }

            bool?  debug                         = null;
            bool?  inMemory                      = null;
            bool?  autoRecompilation             = null;
            bool?  allowPartiallyTrustedCallers  = null;
            string temporarySourceFilesDirectory = null;
            bool?  saveFiles                     = null;
            List <ReferencedAssembly> references = new List <ReferencedAssembly>();
            string actionExtension               = null;

            if (section.Attributes["debug"] != null)
            {
                debug = bool.Parse(section.Attributes["debug"].Value);
            }
            if (section.Attributes["inMemory"] != null)
            {
                inMemory = bool.Parse(section.Attributes["inMemory"].Value);
            }
            if (section.Attributes["autoRecompilation"] != null)
            {
                autoRecompilation = bool.Parse(section.Attributes["autoRecompilation"].Value);
            }
            if (section.Attributes["allowPartiallyTrustedCallers"] != null)
            {
                allowPartiallyTrustedCallers = bool.Parse(section.Attributes["allowPartiallyTrustedCallers"].Value);
            }
            if (section.Attributes["temporarySourceFilesDirectory"] != null)
            {
                temporarySourceFilesDirectory = section.Attributes["temporarySourceFilesDirectory"].Value;
            }
            if (section.Attributes["saveFiles"] != null)
            {
                saveFiles = bool.Parse(section.Attributes["saveFiles"].Value);
            }
            foreach (XmlNode reference in section.SelectNodes("reference"))
            {
                string name = reference.Attributes["assembly"].Value;
                ReferencedAssembly.AssemblySource source = ReferencedAssembly.AssemblySource.BinDirectory;
                if (reference.Attributes["isFromGac"] != null)
                {
                    if (reference.Attributes["isFromGac"].Value.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        source = ReferencedAssembly.AssemblySource.GlobalAssemblyCache;
                    }
                }
                references.Add(new ReferencedAssembly(name, source));
            }

            AspViewCompilerOptions compilerOptions = new AspViewCompilerOptions(
                debug, inMemory, autoRecompilation, allowPartiallyTrustedCallers, temporarySourceFilesDirectory, saveFiles, references);

            if (section.Attributes["actionExtension"] != null)
            {
                actionExtension = section.Attributes["actionExtension"].Value;
                if (actionExtension[0] != '.')
                {
                    actionExtension = "." + actionExtension;
                }
            }

            AspViewEngineOptions options = new AspViewEngineOptions(actionExtension, compilerOptions);

            return(options);
        }
Beispiel #4
0
 public AspViewEngineOptions(AspViewCompilerOptions compilerOptions)
 {
     this.compilerOptions = compilerOptions;
 }
Beispiel #5
0
 public AspViewCompiler(AspViewCompilerOptions options)
 {
     this.options = options;
     preProcessor = new AspViewPreProcessor();
     InitializeCompilerParameters();
 }
		public AspViewCompiler(AspViewCompilerOptions options)
		{
			this.options = options;
			preProcessor = new AspViewPreProcessor();
			InitializeCompilerParameters();
		}
		public AspViewEngineOptions(AspViewCompilerOptions compilerOptions)
		{
			this.compilerOptions = compilerOptions;
		}