Files
mono/mcs/class/referencesource/System.Web.Extensions/ui/AppLevelCompilationSectionCache.cs
dotnet-bot adf899c629 Adding System.Data..., System.ServiceModel..., and System.Web...
Adding reference source for
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Entity.Design
System.Data.Linq
System.Data.SqlXml
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Activities
System.ServiceModel.Channels
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.WasHosting
System.ServiceModel.Web
System.Web
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Entity
System.Web.Entity.Design
System.Web.Extensions
System.Web.Mobile
System.Web.Routing
System.Web.Services
System.Xml
System.Xml.Linq
2016-05-03 00:07:37 +02:00

51 lines
1.7 KiB
C#

//------------------------------------------------------------------------------
// <copyright file="AppLevelCompilationSectionCache.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.Web.UI {
using System;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Web.Configuration;
// The compilation section can be defined below the application level, but ScriptManager only considers the
// application-level debug setting.
internal sealed class AppLevelCompilationSectionCache : ICompilationSection {
private static readonly AppLevelCompilationSectionCache _instance = new AppLevelCompilationSectionCache();
// Value is cached statically, because AppLevelCompilationSectionCache is a Singleton.
private bool? _debug;
private AppLevelCompilationSectionCache() {
}
public static AppLevelCompilationSectionCache Instance {
get {
return _instance;
}
}
public bool Debug {
get {
if (_debug == null) {
_debug = GetDebugFromConfig();
}
return _debug.Value;
}
}
[
ConfigurationPermission(SecurityAction.Assert, Unrestricted = true),
SecuritySafeCritical(),
]
private static bool GetDebugFromConfig() {
CompilationSection section =
(CompilationSection)WebConfigurationManager.GetWebApplicationSection("system.web/compilation");
return section.Debug;
}
}
}