You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="AppSettings.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// AppSettings.cs
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace System.ComponentModel.DataAnnotations {
|
||||
internal static class AppSettings {
|
||||
#if MONO
|
||||
internal static readonly bool DisableRegEx = false;
|
||||
#else
|
||||
private static volatile bool _settingsInitialized = false;
|
||||
private static object _appSettingsLock = new object();
|
||||
private static void EnsureSettingsLoaded() {
|
||||
if (!_settingsInitialized) {
|
||||
lock (_appSettingsLock) {
|
||||
if (!_settingsInitialized) {
|
||||
NameValueCollection settings = null;
|
||||
|
||||
try {
|
||||
settings = ConfigurationManager.AppSettings;
|
||||
}
|
||||
catch (ConfigurationErrorsException) { }
|
||||
finally {
|
||||
if (settings == null || !Boolean.TryParse(settings["dataAnnotations:dataTypeAttribute:disableRegEx"], out _disableRegEx))
|
||||
_disableRegEx = false;
|
||||
|
||||
_settingsInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool _disableRegEx;
|
||||
internal static bool DisableRegEx {
|
||||
get {
|
||||
EnsureSettingsLoaded();
|
||||
return _disableRegEx;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user