Exemplo n.º 1
0
 internal static SlotConfigNamesUpdate ToSlotConfigNamesUpdate(this Utilities.SiteConfig config)
 {
     return(new SlotConfigNamesUpdate
     {
         AppSettingNames = config.SlotStickyAppSettingNames,
         ConnectionStringNames = config.SlotStickyConnectionStringNames
     });
 }
Exemplo n.º 2
0
        internal static Utilities.SiteConfig ToSiteConfig(this WebSiteGetConfigurationResponse getConfigResponse)
        {
            var config = new Utilities.SiteConfig
            {
                NumberOfWorkers             = getConfigResponse.NumberOfWorkers,
                DefaultDocuments            = getConfigResponse.DefaultDocuments.ToArray(),
                NetFrameworkVersion         = getConfigResponse.NetFrameworkVersion,
                PhpVersion                  = getConfigResponse.PhpVersion,
                RequestTracingEnabled       = getConfigResponse.RequestTracingEnabled,
                HttpLoggingEnabled          = getConfigResponse.HttpLoggingEnabled,
                DetailedErrorLoggingEnabled = getConfigResponse.DetailedErrorLoggingEnabled,
                PublishingUsername          = getConfigResponse.PublishingUserName,
                PublishingPassword          = getConfigResponse.PublishingPassword,
                AppSettings                 = getConfigResponse.AppSettings.Select(ToNameValuePair).ToList(),
                Metadata          = getConfigResponse.Metadata.Select(ToNameValuePair).ToList(),
                ConnectionStrings = new Utilities.ConnStringPropertyBag(
                    getConfigResponse.ConnectionStrings.Select(cs => new Utilities.ConnStringInfo
                {
                    ConnectionString = cs.ConnectionString,
                    Name             = cs.Name,
                    Type             = (Utilities.DatabaseType)Enum.Parse(typeof(Utilities.DatabaseType), cs.Type.ToString(), ignoreCase: true)
                }).ToList()),
                HandlerMappings = getConfigResponse.HandlerMappings.Select(hm => new Utilities.HandlerMapping
                {
                    Arguments       = hm.Arguments,
                    Extension       = hm.Extension,
                    ScriptProcessor = hm.ScriptProcessor
                }).ToArray(),
                ManagedPipelineMode    = getConfigResponse.ManagedPipelineMode,
                WebSocketsEnabled      = getConfigResponse.WebSocketsEnabled,
                RemoteDebuggingEnabled = getConfigResponse.RemoteDebuggingEnabled,
                RemoteDebuggingVersion = getConfigResponse.RemoteDebuggingVersion.GetValueOrDefault(),
                RoutingRules           = getConfigResponse.RoutingRules.Select(r => r.ToRoutingRule()).ToList(),
                Use32BitWorkerProcess  = getConfigResponse.Use32BitWorkerProcess,
                AutoSwapSlotName       = getConfigResponse.AutoSwapSlotName,
            };

            return(config);
        }
Exemplo n.º 3
0
        internal static WebSiteUpdateConfigurationParameters ToConfigUpdateParameters(this Utilities.SiteConfig config)
        {
            var parameters = new WebSiteUpdateConfigurationParameters
            {
                DetailedErrorLoggingEnabled = config.DetailedErrorLoggingEnabled,
                HttpLoggingEnabled          = config.HttpLoggingEnabled,
                NetFrameworkVersion         = config.NetFrameworkVersion,
                NumberOfWorkers             = config.NumberOfWorkers,
                PhpVersion             = config.PhpVersion,
                RequestTracingEnabled  = config.RequestTracingEnabled,
                ManagedPipelineMode    = config.ManagedPipelineMode,
                WebSocketsEnabled      = config.WebSocketsEnabled,
                RemoteDebuggingEnabled = config.RemoteDebuggingEnabled,
                RemoteDebuggingVersion = config.RemoteDebuggingVersion,
                RoutingRules           = config.RoutingRules.Select(r => r.ToRoutingRule()).ToArray(),
                Use32BitWorkerProcess  = config.Use32BitWorkerProcess,
                AutoSwapSlotName       = config.AutoSwapSlotName,
            };

            if (config.AppSettings != null)
            {
                config.AppSettings.ForEach(nvp => parameters.AppSettings.Add(ToKeyValuePair(nvp)));
            }

            if (config.ConnectionStrings != null)
            {
                config.ConnectionStrings.ForEach(
                    csi => parameters.ConnectionStrings.Add(new WebSiteUpdateConfigurationParameters.ConnectionStringInfo
                {
                    Name             = csi.Name,
                    ConnectionString = csi.ConnectionString,
                    Type             = (Management.WebSites.Models.ConnectionStringType)Enum.Parse(typeof(Management.WebSites.Models.ConnectionStringType), csi.Type.ToString(), ignoreCase: true)
                }));
            }

            if (config.DefaultDocuments != null)
            {
                config.DefaultDocuments.ForEach(d => parameters.DefaultDocuments.Add(d));
            }

            if (config.HandlerMappings != null)
            {
                config.HandlerMappings.ForEach(
                    hm => parameters.HandlerMappings.Add(new WebSiteUpdateConfigurationParameters.HandlerMapping
                {
                    Arguments       = hm.Arguments,
                    Extension       = hm.Extension,
                    ScriptProcessor = hm.ScriptProcessor
                }));
            }

            if (config.Metadata != null)
            {
                config.Metadata.ForEach(nvp => parameters.Metadata.Add(ToKeyValuePair(nvp)));
            }

            return(parameters);
        }
 internal static Utilities.SiteConfig ToSiteConfig(this WebSiteGetConfigurationResponse getConfigResponse)
 {
     var config = new Utilities.SiteConfig
     {
         NumberOfWorkers = getConfigResponse.NumberOfWorkers,
         DefaultDocuments = getConfigResponse.DefaultDocuments.ToArray(),
         NetFrameworkVersion = getConfigResponse.NetFrameworkVersion,
         PhpVersion = getConfigResponse.PhpVersion,
         RequestTracingEnabled = getConfigResponse.RequestTracingEnabled,
         HttpLoggingEnabled = getConfigResponse.HttpLoggingEnabled,
         DetailedErrorLoggingEnabled = getConfigResponse.DetailedErrorLoggingEnabled,
         PublishingUsername = getConfigResponse.PublishingUserName,
         PublishingPassword = getConfigResponse.PublishingPassword,
         AppSettings = getConfigResponse.AppSettings.Select(ToNameValuePair).ToList(),
         Metadata = getConfigResponse.Metadata.Select(ToNameValuePair).ToList(),
         ConnectionStrings = new Utilities.ConnStringPropertyBag(
             getConfigResponse.ConnectionStrings.Select(cs => new Utilities.ConnStringInfo
             {
                 ConnectionString = cs.ConnectionString,
                 Name = cs.Name,
                 Type = (Utilities.DatabaseType)Enum.Parse(typeof(Utilities.DatabaseType), cs.Type.ToString(), ignoreCase: true)
             }).ToList()),
         HandlerMappings = getConfigResponse.HandlerMappings.Select(hm => new Utilities.HandlerMapping
         {
             Arguments = hm.Arguments,
             Extension = hm.Extension,
             ScriptProcessor = hm.ScriptProcessor
         }).ToArray(),
         ManagedPipelineMode = getConfigResponse.ManagedPipelineMode,
         WebSocketsEnabled = getConfigResponse.WebSocketsEnabled,
         RemoteDebuggingEnabled = getConfigResponse.RemoteDebuggingEnabled,
         RemoteDebuggingVersion = getConfigResponse.RemoteDebuggingVersion.GetValueOrDefault(),
         RoutingRules = getConfigResponse.RoutingRules.Select(r => r.ToRoutingRule()).ToList(),
         Use32BitWorkerProcess = getConfigResponse.Use32BitWorkerProcess
     };
     return config;
 }