The Labs \ Source Viewer \ SSCLI \ System.Configuration.Internal \ IInternalConfigHost

  1. //------------------------------------------------------------------------------
  2. // <copyright file="IInternalConfigHost.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System;
  16. using System.Diagnostics.CodeAnalysis;
  17. using System.IO;
  18. using System.Security;
  19. using System.Collections.Specialized;
  20. using System.Configuration;
  21. using ClassConfiguration = System.Configuration.Configuration;
  22. //
  23. // This file contains most of the interfaces that allow System.Web, Venus, and
  24. // Whitehorse to customize configuration in some way.
  25. //
  26. // The goal of the design of customization is to only require other MS assemblies
  27. // to create an instance of an internal object via Activator.CreateInstance(), and then
  28. // use these objects through *public* System.Configuration.Internal interfaces.
  29. // We do not want extenders to have to use reflection to call a method - it is slow,
  30. // not typesafe, and more difficult to promote correct use of the internal object.
  31. //
  32. namespace System.Configuration.Internal
  33. {
  34.    
  35.     //
  36.     // The functionality required of a configuration host.
  37.     //
  38.     [System.Runtime.InteropServices.ComVisible(false)]
  39.     public interface IInternalConfigHost
  40.     {
  41.         void Init(IInternalConfigRoot configRoot, params object[] hostInitParams);
  42.         void InitForConfiguration(ref string locationSubPath, out string configPath, out string locationConfigPath, IInternalConfigRoot configRoot, params object[] hostInitConfigurationParams);
  43.        
  44.         // To support creation of new config record - whether that path requires a configRecord.
  45.         bool IsConfigRecordRequired(string configPath);
  46.         bool IsInitDelayed(IInternalConfigRecord configRecord);
  47.         void RequireCompleteInit(IInternalConfigRecord configRecord);
  48.        
  49.         bool IsSecondaryRoot(string configPath);
  50.        
  51.         // stream support
  52.         string GetStreamName(string configPath);
  53.         string GetStreamNameForConfigSource(string streamName, string configSource);
  54.         object GetStreamVersion(string streamName);
  55.        
  56.         // default impl treats name as a file name
  57.         // null means stream doesn't exist for this name
  58.         Stream OpenStreamForRead(string streamName);
  59.         Stream OpenStreamForRead(string streamName, bool assertPermissions);
  60.         [SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "2#")]
  61.         Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext);
  62.         [SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference", MessageId = "2#")]
  63.         Stream OpenStreamForWrite(string streamName, string templateStreamName, ref object writeContext, bool assertPermissions);
  64.         void WriteCompleted(string streamName, bool success, object writeContext);
  65.         void WriteCompleted(string streamName, bool success, object writeContext, bool assertPermissions);
  66.         void DeleteStream(string streamName);
  67.        
  68.         // ConfigurationErrorsException support
  69.         bool IsFile(string streamName);
  70.        
  71.         // change notification support - runtime only
  72.         bool SupportsChangeNotifications {
  73.             get;
  74.         }
  75.         object StartMonitoringStreamForChanges(string streamName, StreamChangeCallback callback);
  76.         void StopMonitoringStreamForChanges(string streamName, StreamChangeCallback callback);
  77.        
  78.         // RefreshConfig support - runtime only
  79.         bool SupportsRefresh {
  80.             get;
  81.         }
  82.        
  83.         // path support: whether we support Path attribute in location.
  84.         bool SupportsPath {
  85.             get;
  86.         }
  87.        
  88.         // location support
  89.         bool SupportsLocation {
  90.             get;
  91.         }
  92.         bool IsAboveApplication(string configPath);
  93.         string GetConfigPathFromLocationSubPath(string configPath, string locationSubPath);
  94.         bool IsLocationApplicable(string configPath);
  95.        
  96.         // definition support
  97.         bool IsDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition);
  98.         void VerifyDefinitionAllowed(string configPath, ConfigurationAllowDefinition allowDefinition, ConfigurationAllowExeDefinition allowExeDefinition, IConfigErrorInfo errorInfo);
  99.        
  100.         // security support
  101.         bool IsTrustedConfigPath(string configPath);
  102.         bool IsFullTrustSectionWithoutAptcaAllowed(IInternalConfigRecord configRecord);
  103.         void GetRestrictedPermissions(IInternalConfigRecord configRecord, out PermissionSet permissionSet, out bool isHostReady);
  104.         IDisposable Impersonate();
  105.        
  106.         // prefetch support
  107.         bool PrefetchAll(string configPath, string streamName);
  108.         // E.g. If the config file is downloaded from HTTP, we want to prefetch everything.
  109.         bool PrefetchSection(string sectionGroupName, string sectionName);
  110.        
  111.         // context support
  112.         object CreateDeprecatedConfigContext(string configPath);
  113.         object CreateConfigurationContext(string configPath, string locationSubPath);
  114.        
  115.         // Encrypt/decrypt support
  116.         string DecryptSection(string encryptedXml, ProtectedConfigurationProvider protectionProvider, ProtectedConfigurationSection protectedConfigSection);
  117.         string EncryptSection(string clearTextXml, ProtectedConfigurationProvider protectionProvider, ProtectedConfigurationSection protectedConfigSection);
  118.        
  119.         // Type name support
  120.         // E.g. to support type defined in app_code
  121.         Type GetConfigType(string typeName, bool throwOnError);
  122.         string GetConfigTypeName(Type t);
  123.        
  124.         // Remote support
  125.         // Used by MgmtConfigurationRecord during SaveAs
  126.         bool IsRemote {
  127.             get;
  128.         }
  129.     }
  130. }

Developer Fusion