Ejemplo n.º 1
0
 /// <summary>
 /// Temporarily overrides the current provider settings for the scope of the given action
 /// </summary>
 /// <param name="change">The callback to temporarily change the current settings</param>
 /// <param name="action">The action to run while the settings are changed</param>
 public static void Override(Action <ProviderImplementationSettings> change, Action action)
 {
     // default settings is used for lock because it never changes. Current settings will change, and so is a bad choice for the lock
     lock (defaultSettings)
     {
         var originalSettings = currentSettings;
         try
         {
             var settings = new ProviderImplementationSettings(Current);
             currentSettings = settings;
             allowEditing    = true;
             change(settings);
             allowEditing = false;
             action();
         }
         finally
         {
             allowEditing    = false;
             currentSettings = originalSettings;
         }
     }
 }
 /// <summary>
 /// Temporarily overrides the current provider settings for the scope of the given action
 /// </summary>
 /// <param name="change">The callback to temporarily change the current settings</param>
 /// <param name="action">The action to run while the settings are changed</param>
 public static void Override(Action<ProviderImplementationSettings> change, Action action)
 {
     // default settings is used for lock because it never changes. Current settings will change, and so is a bad choice for the lock
     lock (defaultSettings)
     {
         var originalSettings = currentSettings;
         try
         {
             var settings = new ProviderImplementationSettings(Current);
             currentSettings = settings;
             allowEditing = true;
             change(settings);
             allowEditing = false;
             action();
         }
         finally
         {
             allowEditing = false;
             currentSettings = originalSettings;
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the ProviderImplementationSettings class by copying the given settings.
 /// </summary>
 /// <param name="toCopy">The settings to copy. Must be the current settings.</param>
 private ProviderImplementationSettings(ProviderImplementationSettings toCopy)
 {
     ExceptionUtilities.Assert(Current == toCopy, "Only the current settings can be copied");
     this.strictInputVerification = toCopy.strictInputVerification;
 }
 /// <summary>
 /// Initializes a new instance of the ProviderImplementationSettings class by copying the given settings.
 /// </summary>
 /// <param name="toCopy">The settings to copy. Must be the current settings.</param>
 private ProviderImplementationSettings(ProviderImplementationSettings toCopy)
 {
     ExceptionUtilities.Assert(Current == toCopy, "Only the current settings can be copied");
     this.strictInputVerification = toCopy.strictInputVerification;
 }