private static string GetEnvironmentValue(IServiceHostParameter serviceHostParameter, string environment) { var envValue = serviceHostParameter.ServiceHost.ConfigSet.Environments.Single(e => string.Equals(e.Name, environment, StringComparison.OrdinalIgnoreCase)) .SubstitutionParameters.SingleOrDefault(p => string.Equals(p.Name, string.Format("{0}_{1}", serviceHostParameter.ServiceHost.Name, serviceHostParameter.Name), StringComparison.OrdinalIgnoreCase)); return(envValue.IsInstance() ? string.Format(serviceHostParameter.Value, envValue.Value) : serviceHostParameter.Value); }
public void UpdateHostParameter(IServiceHostParameter serviceHostParameter) { serviceHostParameter.ServiceHost.ConfigSet.LastUpdate = DateTime.UtcNow; if (serviceHostParameter.IsEnvironmental) { foreach (var environment in serviceHostParameter.ServiceHost.ConfigSet.Environments) { var paramName = string.Format("{0}_{1}", serviceHostParameter.ServiceHost.Name, serviceHostParameter.Name); var subParam = environment.SubstitutionParameters.SingleOrDefault(sp => sp.Name == paramName); if (subParam.IsNull()) { subParam = environment.CreateSubstitutionParameters(Repository, paramName); } subParam.Description = serviceHostParameter.Description; if (serviceHostParameter.SubstitutionParameters == null) { serviceHostParameter.SubstitutionParameters = new List <ISubstitutionParameter>(); } if (!serviceHostParameter.SubstitutionParameters.Contains(subParam)) { serviceHostParameter.SubstitutionParameters.Add(subParam); } } } Repository.SaveChanges(); }
public static List <BreadCrumbItem> GetTrail(this IServiceHostParameter self) { return(new List <BreadCrumbItem> { ConfigSet(self.ServiceHost.ConfigSet), ServiceHost(self.ServiceHost) }); }
private static IServiceHostParameter CreateChild(this IServiceHostParameter endpointParameter, ConfigurationContext context, IServiceHostSettings serviceHost) { var child = context.ServiceHostParameters.Create(); child.Name = endpointParameter.Name; child.ServiceHostSettingsNameId = serviceHost.Id; child.ServiceHost = serviceHost; child.Parent = endpointParameter; child.IsSecureString = endpointParameter.IsSecureString; serviceHost.Parameters.Add(child); return(child); }
public void UpdateHostParameter(IServiceHostParameter serviceHostParameter) { serviceHostParameter.ServiceHost.ConfigSet.LastUpdate = DateTime.UtcNow; if (serviceHostParameter.IsEnvironmental) { foreach (var environment in serviceHostParameter.ServiceHost.ConfigSet.Environments) { var paramName = string.Format("{0}_{1}", serviceHostParameter.ServiceHost.Name, serviceHostParameter.Name); var subParam = environment.SubstitutionParameters.SingleOrDefault(sp => sp.Name == paramName); if (subParam.IsNull()) subParam = environment.CreateSubstitutionParameters(Repository, paramName); subParam.Description = serviceHostParameter.Description; if (serviceHostParameter.SubstitutionParameters == null) serviceHostParameter.SubstitutionParameters = new List<ISubstitutionParameter>(); if (!serviceHostParameter.SubstitutionParameters.Contains(subParam)) { serviceHostParameter.SubstitutionParameters.Add(subParam); } } } Repository.SaveChanges(); }
public void DeleteServiceHostParameter(IServiceHostParameter par) { par.ServiceHost.Parameters.Remove(par); Repository.DeleteObject(par); Repository.SaveChanges(); }
private static void AddToChildren(IServiceHostSettings serviceHost, ConfigurationContext context, IServiceHostParameter substitutionParameter) { foreach (var serviceHostSettingse in serviceHost.Children) { var child = substitutionParameter.CreateChild(context, serviceHostSettingse); AddToChildren(serviceHostSettingse, context, child); } }
public static bool UserHasAccessTo(this IServiceHostParameter self) { return(self.ServiceHost.UserHasAccessTo()); }
private static string GetDataCentersEnvironmentKey(IServiceHostParameter datacentersKey) { return(datacentersKey.ServiceHost.Name + "_" + datacentersKey.Name); }
private static string GetDataCentersEnvironmentKey(IServiceHostParameter datacentersKey) { return datacentersKey.ServiceHost.Name + "_" + datacentersKey.Name; }
private static string GetEnvironmentValue(IServiceHostParameter serviceHostParameter, string environment) { var envValue=serviceHostParameter.ServiceHost.ConfigSet.Environments.Single(e => string.Equals(e.Name, environment, StringComparison.OrdinalIgnoreCase)) .SubstitutionParameters.SingleOrDefault(p => string.Equals(p.Name, string.Format("{0}_{1}", serviceHostParameter.ServiceHost.Name, serviceHostParameter.Name), StringComparison.OrdinalIgnoreCase)); return envValue.IsInstance() ? string.Format(serviceHostParameter.Value, envValue.Value) : serviceHostParameter.Value; }