public static IEnvironment CreateEnvironment(this IConfigSet configSet, ConfigurationContext context, string name, bool isImport = false)
 {
     var environment = context.Environments.Create();
     environment.ConfigSet = configSet;
     environment.ConfigSetNameId = configSet.Id;
     environment.Name = name;
     foreach (var serviceParameter in ServiceParameters)
     {
         environment.CreateSubstitutionParameters(context, serviceParameter, isImport);
     }
     context.SaveChanges();
     foreach (var service in configSet.Services)
     {
         var addressOverride = string.Format("{0}_Address", service.Name);
         var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase));
         if (overrideProp.IsNull())
         {
             var subParam = environment.CreateSubstitutionParameters(context, addressOverride);
             if (isImport)
                 subParam.ItemValue = "{0}";
         }
     }
     configSet.Environments.Add(environment);
     context.SaveChanges();
     AddToChildren(configSet, context, environment);
     return environment;
 }
 public static IEnvironment CreateChild(this IEnvironment environment, ConfigurationContext context, ref IConfigSet configSet)
 {
     var newEnvironment = context.Environments.Create();
     newEnvironment.ConfigSetNameId = configSet.Id;
     newEnvironment.ConfigSet = configSet;
     newEnvironment.ParentEnvironment = environment;
     newEnvironment.Name = environment.Name;
     configSet.Environments.Add(newEnvironment);
     context.SaveChanges();
     foreach (var substitutionParameter in environment.SubstitutionParameters)
     {
         var child = CreateChild(substitutionParameter, context, ref newEnvironment);
         if (newEnvironment.SubstitutionParameters.All(sp => !string.Equals(sp.Name, substitutionParameter.Name, StringComparison.OrdinalIgnoreCase)))
             newEnvironment.SubstitutionParameters.Add(child);
     }
     foreach (var service in configSet.Services)
     {
         var addressOverride = string.Format("{0}_Address", service.Name);
         var overrideProp = newEnvironment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase));
         if (overrideProp.IsNull())
             newEnvironment.CreateSubstitutionParameters(context, addressOverride);
     }
     foreach (var environmentParameter in environment.EnvironmentParameters)
     {
         newEnvironment.EnvironmentParameters.Add(CreateChild(environmentParameter, context, ref newEnvironment));
     }
     return newEnvironment;
 }
Example #3
0
 public void SetFromRawData(Interstellar.ConfigurationReader.Endpoint endpoint, ConfigurationContext repository)
 {
     CreateParameter("Address", endpoint.Address, repository);
     CreateParameter("Audience", endpoint.Audience, repository);
     CreateParameter("CertificateValidationMode", endpoint.CertificateValidationMode, repository);
     CreateParameter("CloseTimeout", endpoint.CloseTimeout, repository);
     CreateParameter("Durable", endpoint.Durable, repository);
     CreateParameter("ExactlyOnce", endpoint.ExactlyOnce, repository);
     CreateParameter("Ignore", endpoint.Ignore, repository);
     CreateParameter("IssuerActAsAddress", endpoint.IssuerActAsAddress, repository);
     CreateParameter("HostNameComparisonMode", endpoint.HostNameComparisonMode, repository);
     CreateParameter("IssuerAddress", endpoint.IssuerAddress, repository);
     CreateParameter("IssuerMetadataAddress", endpoint.IssuerMetadataAddress, repository);
     CreateParameter("IssuerName", endpoint.IssuerName, repository);
     CreateParameter("MaxBufferPoolSize", endpoint.MaxBufferPoolSize, repository);
     CreateParameter("MaxBufferSize", endpoint.MaxBufferSize, repository);
     CreateParameter("MaxConnections", endpoint.MaxConnections, repository);
     CreateParameter("MaxMessageSize", endpoint.MaxMessageSize, repository);
     CreateParameter("MaxReceivedSize", endpoint.MaxReceivedSize, repository);
     CreateParameter("MessageFormat", endpoint.MessageFormat, repository);
     CreateParameter("TransferMode", endpoint.TransferMode, repository);
     CreateParameter("OpenTimeout", endpoint.OpenTimeout, repository);
     CreateParameter("OverrideSslSecurity", endpoint.OverrideSslSecurity, repository);
     CreateParameter("ReceiveTimeout", endpoint.ReceiveTimeout, repository);
     CreateParameter("SendTimeout", endpoint.SendTimeout, repository);
     CreateParameter("StsAddress", endpoint.StsAddress, repository);
     CreateParameter("TextEncoding", endpoint.TextEncoding, repository);
     CreateParameter("Thumbprint", endpoint.Thumbprint, repository);
 }
Example #4
0
 public ConfigSetTask(IRepositoryFactory repositoryFactory, IEnvironmentTasks environmentTasks)
 {
     this.cacheController = cacheController;
     this.environmentTasks = environmentTasks;
     Repository = repositoryFactory.GetRepository();
     Repository.SavingChanges += SavingChanges;
 }
 public void Configure(ConfigurationContext context, ContainerConfigurationBuilder builder)
 {
     builder.Contract("all").UnionOf("c1", "c2", "c3");
     builder.Contract("c1").BindDependency<FileAccessor>("fileName", "qq");
     builder.Contract("c2").BindDependency<FileAccessor>("fileName", "ww1");
     builder.Contract("c3").BindDependency<FileAccessor>("fileName", "ww2");
     builder.WithInstanceFilter<FileAccessorWrap>(a => a.IsValid());
 }
 private static ConfigurationContext CreateRepository()
 {
     var connectionString = GetConnectionString();
     var context = new ConfigurationContext(connectionString)
     {
         FilterOptimizationEnabled = true
     };
     return context;
 }
Example #7
0
        public void OnInitialize()
        {
            configContext = new ConfigurationContext();

            configContext.Load(configContext.GetVCSConfigurationQuery(), (o) =>
            {
                VCSConfiguration = configContext.VCSConfigurations.SingleOrDefault();
            }, null);
        }
        public void ConfigurationContext_System_GetSection1_TIsMappedToAnotherType()
        {
            ConfigurationContext target = new ConfigurationContext();

            String path = "vizistata.diagnostics/test";
            target.AddPath<System.Net.Configuration.AuthenticationModulesSection>(path);

            target.GetSection<System.Net.Configuration.AuthenticationModulesSection>();
        }
 private static void AddToChildren(IConfigSet configSet, ConfigurationContext context, IEnvironment environment)
 {
     foreach (var childConfigSet in configSet.ChildConfigSets)
     {
         var c = childConfigSet;
         var child = environment.CreateChild(context, ref c);
         context.SaveChanges();
         AddToChildren(c, context, child);
     }
 }
        public void ConfigurationContext_System_GetSection1_Optimal()
        {
            ConfigurationContext target = new ConfigurationContext();

            String path = "vizistata.diagnostics/test";
            target.AddPath<MockConfigurationSection>(path);

            MockConfigurationSection actual = target.GetSection<MockConfigurationSection>();
            Assert.IsNotNull(actual);
        }
 private static ISubstitutionParameter CreateChild(this ISubstitutionParameter substitutionParameter, ConfigurationContext context, ref IEnvironment newEnvironment)
 {
     var subParameter = context.SubstitutionParameters.Create();
     subParameter.EnvironmentNameId = newEnvironment.Id;
     subParameter.Environment = newEnvironment;
     subParameter.Name = substitutionParameter.Name;
     subParameter.Parent = substitutionParameter;
     context.SaveChanges();
     return subParameter;
 }
 public static IEnvironmentParameter CreateChild(this IEnvironmentParameter substitutionParameter, ConfigurationContext context, ref IEnvironment newEnvironment)
 {
     var envParameter = context.EnvironmentParameters.Create();
     envParameter.EnvironmentNameId = newEnvironment.Id;
     envParameter.Environment = newEnvironment;
     envParameter.Name = substitutionParameter.Name;
     envParameter.Parent = substitutionParameter;
     envParameter.IsSecureString = substitutionParameter.IsSecureString;
     context.SaveChanges();
     return envParameter;
 }
Example #13
0
 public UIHierarchy(ConfigurationNode node, IServiceProvider serviceProvider, ConfigurationContext configurationContext)
     : this(serviceProvider, configurationContext)
 {
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     rootNode = node;
     selectedNode = node;
     AddNode(node);
 }
 public static IEnvironment AddIdentitySettingsToEnvironment(this IEnvironment environment, ConfigurationContext context, IdentitySettings identitySettings)
 {
     if (identitySettings.IsNull()) return environment;
     context.SaveChanges();
     SetIdeneityValue(environment, "StsAddress", identitySettings.IssuerAddress);
     SetIdeneityValue(environment, "IssuerName", identitySettings.IssuerName);
     SetIdeneityValue(environment, "CertificateValidationMode", identitySettings.CertificateValidationMode);
     SetIdeneityValue(environment, "Thumbprint", identitySettings.Thumbprint);
     SetIdeneityValue(environment, "Audience", identitySettings.Audiences.FirstOrDefault());
     SetIdeneityValue(environment, "Realm", identitySettings.Realm);
     SetIdeneityValue(environment, "RequireHttps", identitySettings.RequireHttps.ToString().ToLower());
     SetIdeneityValue(environment, "EnforceCertificateValidation", identitySettings.EnforceCertificateValidation.ToString().ToLower());
     return environment;
 }
Example #15
0
 public UIHierarchy(IServiceProvider serviceProvider, ConfigurationContext configurationContext)
 {
     if (serviceProvider == null)
     {
         throw new ArgumentNullException("serviceProvider");
     }
     this.serviceProvider = serviceProvider;
     this.configurationContext = configurationContext;
     this.configDomain = new ConfigurationDesignManagerDomain(serviceProvider);
     nodesByType = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
     nodesById = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
     nodesByName = new Hashtable(CaseInsensitiveHashCodeProvider.Default, CaseInsensitiveComparer.Default);
     storageTable = new StorageTable();
     handlerList = new EventHandlerList();
 }
 public static ISubstitutionParameter CreateSubstitutionParameters(this IEnvironment environment, ConfigurationContext context, string name, bool isImport = false)
 {
     var substitutionParameter = context.SubstitutionParameters.Create();
     substitutionParameter.EnvironmentNameId = environment.Id;
     substitutionParameter.Environment = environment;
     substitutionParameter.Name = name;
     if (name.EndsWith("_Address"))
     {
         var addressRoot = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, "Address", StringComparison.OrdinalIgnoreCase));
         if (addressRoot.IsInstance() && substitutionParameter.IsRoot)
             substitutionParameter.Parent = addressRoot;
     }
     if ((name == "Address" || name == "Audience") && isImport)
         substitutionParameter.ItemValue = "{0}";
     environment.SubstitutionParameters.Add(substitutionParameter);
     return substitutionParameter;
 }
        public static IServiceDescription CreateChild(this IServiceDescription service, ConfigurationContext context, ref IConfigSet configSet)
        {
            var child = context.ServiceDescriptions.Create();
            child.Name = service.Name;
            child.ConfigSetNameId = configSet.Id;
            child.ConfigSet = configSet;
            child.PatentServiceDescription = service;
            service.ChildServiceDescriptions.Add(child);
            context.SaveChanges();
            foreach (var endpoint in service.Endpoints)
            {
                var newEndpoint = endpoint.CreateChild(context, ref child);
                child.Endpoints.Add(newEndpoint);

            }
            foreach (var environment in configSet.Environments)
            {
                var addressOverride = string.Format("{0}_Address", service.Name);
                var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => String.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase));
                if (overrideProp.IsNull())
                    environment.CreateSubstitutionParameters(context, addressOverride);
            }
            return child;
        }
 public static void AddServiceParameters(IServiceDescription service, ConfigurationContext context, IEndpoint endpoint, Dictionary<string, string> wcfServiceParameters)
 {
     foreach (var serviceParameter in wcfServiceParameters.Keys)
     {
         var parameter = context.EndpointParameters.Create();
         parameter.Name = serviceParameter;
         parameter.EndpointNameId = endpoint.Id;
         parameter.Endpoint = endpoint;
         parameter.ConfigurableForEachEnvironment = ParameterIsEnvironmental(serviceParameter, endpoint.Name);
         parameter.IsPerService = ParameterIsEnvironmentalPrService(serviceParameter);
         if (!string.Equals(endpoint.Name, "custom", StringComparison.OrdinalIgnoreCase))
         {
             parameter.ItemValue = serviceParameter == "Address" ? string.Format("{0}{1}.svc/{2}", wcfServiceParameters[serviceParameter], service.Name, endpoint.Name) : wcfServiceParameters[serviceParameter];
         }
         else
         {
             parameter.ItemValue = "{0}";
         }
         endpoint.Parameters.Add(parameter);
     }
 }
 public static IEndpoint CreateEndpoint(this IServiceDescription service, ConfigurationContext context, string endpointName, bool ignoreParameters = false, List<string> parameters = null)
 {
     var endpoint = context.Endpoints.Create();
     endpoint.Name = endpointName;
     endpoint.ServiceNameId = service.Id;
     if (service.Endpoints.Count == 0)
         service.ClientEndpointValue = endpoint.Name;
     if (!ignoreParameters)
     {
         var cParam = CustomServiceParameters;
         if (parameters.IsInstance())
             cParam = parameters.ToDictionary(s => s, v => "{0}");
         AddServiceParameters(service, context, endpoint, string.Equals(endpointName, "custom", StringComparison.OrdinalIgnoreCase) ? cParam : WcfServiceParameters);
     }
     service.Endpoints.Add(endpoint);
     context.SaveChanges();
     CreateSubstitutionParameters(service, context, endpointName, endpoint);
     return endpoint;
 }
Example #20
0
        /// <summary>
        /// Returns the named ISecurityCacheProvider instance. Guaranteed to return an initialized ISecurityCacheProvider if no exception thrown.
        /// </summary>
        /// <param name="securityCacheProviderName">Name defined in configuration for the SecurityCache provider to instantiate</param>
        /// <returns>Named SecurityCache provider instance</returns>
        /// <exception cref="ArgumentNullException">providerName is null</exception>
        /// <exception cref="ArgumentException">providerName is empty</exception>
        /// <exception cref="ConfigurationException">Could not find instance specified in providerName</exception>
        /// <exception cref="InvalidOperationException">Error processing configuration information defined in application configuration file.</exception>
        public static ISecurityCacheProvider GetSecurityCacheProvider(string securityCacheProviderName)
        {
            ConfigurationContext context = ConfigurationManager.GetCurrentContext();

            return(GetSecurityCacheProvider(securityCacheProviderName, context));
        }
Example #21
0
 public RealtyRepository(ConfigurationContext db)
 {
     _db = db;
 }
 public AttributeRepository()
 {
     _attributeContext = new ConfigurationContext();
 }
 public void Initialize(ConfigurationContext configurationContext)
 {
 }
 public static IServiceHostSettings CreateChild(this IServiceHostSettings service, ConfigurationContext context, ref IConfigSet configSet)
 {
     var child = context.ServiceHostSettingss.Create();
     child.Name = service.Name;
     child.ConfigSetNameId = configSet.Id;
     child.ConfigSet = configSet;
     child.Parent = service;
     foreach (var parameter in service.Parameters)
     {
         parameter.CreateChild(context, child);
     }
     return child;
 }
Example #25
0
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="AuthenticationProviderFactory"/> class with a <see cref="ConfigurationContext"/>.</para>
 /// </summary>
 /// <param name="context"><para>A <see cref="ConfigurationContext"/> containing the configuration data to use.</para></param>
 public AuthenticationProviderFactory(ConfigurationContext context) : base(SR.Authentication, context, typeof(IAuthenticationProvider))
 {
 }
Example #26
0
 public AddressRepository(ConfigurationContext db)
 {
     _db = db;
 }
        /// <summary>
        /// Adds serializer support.
        /// </summary>
        /// <param name="services">The service collection.</param>
        /// <param name="configure">The configuration delegate.</param>
        /// <returns>The service collection.</returns>
        public static IServiceCollection AddSerializer(this IServiceCollection services, Action <ISerializerBuilder> configure = null)
        {
            // Only add the services once.
            var context = GetFromServices <ConfigurationContext>(services);

            if (context is null)
            {
                context = new ConfigurationContext(services);
                foreach (var asm in ReferencedAssemblyHelper.GetRelevantAssemblies(services))
                {
                    context.Builder.AddAssembly(asm);
                }

                services.Add(context.CreateServiceDescriptor());
                services.AddOptions();
                services.AddSingleton <IConfigureOptions <TypeManifestOptions>, DefaultTypeManifestProvider>();
                services.AddSingleton <TypeResolver, CachedTypeResolver>();
                services.AddSingleton <TypeConverter>();
                services.TryAddSingleton(typeof(ListActivator <>));
                services.TryAddSingleton(typeof(DictionaryActivator <,>));
                services.TryAddSingleton <CodecProvider>();
                services.TryAddSingleton <ICodecProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton <IDeepCopierProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton <IFieldCodecProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton <IBaseCodecProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton <IValueSerializerProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton <IActivatorProvider>(sp => sp.GetRequiredService <CodecProvider>());
                services.TryAddSingleton(typeof(IFieldCodec <>), typeof(FieldCodecHolder <>));
                services.TryAddSingleton(typeof(IBaseCodec <>), typeof(BaseCodecHolder <>));
                services.TryAddSingleton(typeof(IValueSerializer <>), typeof(ValueSerializerHolder <>));
                services.TryAddSingleton(typeof(DefaultActivator <>));
                services.TryAddSingleton(typeof(IActivator <>), typeof(ActivatorHolder <>));
                services.TryAddSingleton <WellKnownTypeCollection>();
                services.TryAddSingleton <TypeCodec>();
                services.TryAddSingleton(typeof(IDeepCopier <>), typeof(CopierHolder <>));
                services.TryAddSingleton(typeof(IBaseCopier <>), typeof(BaseCopierHolder <>));

                // Type filtering
                services.AddSingleton <ITypeNameFilter, DefaultTypeFilter>();

                // Session
                services.TryAddSingleton <SerializerSessionPool>();
                services.TryAddSingleton <CopyContextPool>();

                services.AddSingleton <IGeneralizedCodec, CompareInfoCodec>();
                services.AddSingleton <IGeneralizedCopier, CompareInfoCopier>();
                services.AddSingleton <IGeneralizedCodec, WellKnownStringComparerCodec>();

                services.AddSingleton <ExceptionCodec>();
                services.AddSingleton <IGeneralizedCodec>(sp => sp.GetRequiredService <ExceptionCodec>());
                services.AddSingleton <IGeneralizedBaseCodec>(sp => sp.GetRequiredService <ExceptionCodec>());

                // Serializer
                services.TryAddSingleton <ObjectSerializer>();
                services.TryAddSingleton <Serializer>();
                services.TryAddSingleton(typeof(Serializer <>));
                services.TryAddSingleton(typeof(ValueSerializer <>));
                services.TryAddSingleton <DeepCopier>();
                services.TryAddSingleton(typeof(DeepCopier <>));
            }

            configure?.Invoke(context.Builder);

            return(services);
        }
 /// <summary>
 /// Creates new instance of the handler.
 /// </summary>
 /// <param name="configurationContext">Configuration settings.</param>
 public DeleteResourceHandler(ConfigurationContext configurationContext)
 {
     _configurationContext = configurationContext;
 }
Example #29
0
 public LoginManager(Tenant tenant, ConfigurationContext configurationContext)
 {
     _tenant = tenant;
     _configurationContext = configurationContext;
 }
Example #30
0
        public static ISubstitutionParameter CreateSubstitutionParameters(this IEnvironment environment, ConfigurationContext context, string name, bool isImport = false)
        {
            var substitutionParameter = context.SubstitutionParameters.Create();

            substitutionParameter.EnvironmentNameId = environment.Id;
            substitutionParameter.Environment       = environment;
            substitutionParameter.Name = name;
            if (name.EndsWith("_Address"))
            {
                var addressRoot = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, "Address", StringComparison.OrdinalIgnoreCase));
                if (addressRoot.IsInstance() && substitutionParameter.IsRoot)
                {
                    substitutionParameter.Parent = addressRoot;
                }
            }
            if ((name == "Address" || name == "Audience") && isImport)
            {
                substitutionParameter.ItemValue = "{0}";
            }
            environment.SubstitutionParameters.Add(substitutionParameter);
            return(substitutionParameter);
        }
Example #31
0
        private static void EnsureUriFormat(string format, string propertyName, ConfigurationSettings settings, IConfigSet configSet, ConfigurationContext context)
        {
            var hostSettings = configSet.ServiceHosts.Single(s => String.Equals(s.Name, settings.DataCenterServiceHostName, StringComparison.OrdinalIgnoreCase));
            var param        = hostSettings.Parameters.SingleOrDefault(p => string.Equals(p.Name, propertyName, StringComparison.OrdinalIgnoreCase));

            if (param.IsNull())
            {
                param           = hostSettings.CreateParameter(context, propertyName, false, true);
                param.ItemValue = "{0}";
                if (param.IsEnvironmental)
                {
                    foreach (var environment in hostSettings.ConfigSet.Environments)
                    {
                        environment.CreateSubstitutionParameters(context, hostSettings.Name + "_" + param.Name);
                    }
                }
            }
            var env = configSet.Environments.Single(e => e.Name == settings.Environment);

            var subPar = env.SubstitutionParameters.SingleOrDefault(sp => sp.Name == hostSettings.Name + "_" + propertyName);

            if (subPar.IsNull())
            {
                subPar = env.CreateSubstitutionParameters(context, hostSettings.Name + "_" + propertyName);
            }
            subPar.ItemValue = format;
            context.SaveChanges();
        }
 private static void AddToChildren(IServiceDescription service, ConfigurationContext context, IEndpoint endpoint)
 {
     foreach (var child in service.ChildServiceDescriptions)
     {
         var c = child;
         var childEndpoint = endpoint.CreateChild(context, ref c);
         child.Endpoints.Add(childEndpoint);
         context.SaveChanges();
         AddToChildren(c, context, childEndpoint);
     }
 }
 private static IEndpointParameter CreateChild(IEndpointParameter endpointParameter, ConfigurationContext context, IEndpoint enpoint)
 {
     var child = context.EndpointParameters.Create();
     child.Name = endpointParameter.Name;
     child.EndpointNameId = enpoint.Id;
     child.Parent = endpointParameter;
     child.Endpoint = enpoint;
     child.IsPerService = endpointParameter.IsPerService;
     child.ConfigurableForEachEnvironment = endpointParameter.ConfigurableForEachEnvironment;
     return child;
 }
Example #34
0
 public ConfigsController(ConfigurationContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
        public static IServiceHostSettings CreateChild(this IServiceHostSettings service, ConfigurationContext context, ref IConfigSet configSet)
        {
            var child = context.ServiceHostSettingss.Create();

            child.Name            = service.Name;
            child.ConfigSetNameId = configSet.Id;
            child.ConfigSet       = configSet;
            child.Parent          = service;
            foreach (var parameter in service.Parameters)
            {
                parameter.CreateChild(context, child);
            }
            return(child);
        }
Example #36
0
 public void Configure(ConfigurationContext context, ServiceConfigurationBuilder <C> builder)
 {
     builder.Contract <Contract1Attribute>().Contract <Contract2Attribute>().Dependencies(new { parameter = 1 });
     builder.Contract <Contract2Attribute>().Dependencies(new { parameter = 2 });
 }
Example #37
0
 public static IEnvironment AddIdentitySettingsToEnvironment(this IEnvironment environment, ConfigurationContext context, IdentitySettings identitySettings)
 {
     if (identitySettings.IsNull())
     {
         return(environment);
     }
     context.SaveChanges();
     SetIdeneityValue(environment, "StsAddress", identitySettings.IssuerAddress);
     SetIdeneityValue(environment, "IssuerName", identitySettings.IssuerName);
     SetIdeneityValue(environment, "CertificateValidationMode", identitySettings.CertificateValidationMode);
     SetIdeneityValue(environment, "Thumbprint", identitySettings.Thumbprint);
     SetIdeneityValue(environment, "Audience", identitySettings.Audiences.FirstOrDefault());
     SetIdeneityValue(environment, "Realm", identitySettings.Realm);
     SetIdeneityValue(environment, "RequireHttps", identitySettings.RequireHttps.ToString().ToLower());
     SetIdeneityValue(environment, "EnforceCertificateValidation", identitySettings.EnforceCertificateValidation.ToString().ToLower());
     return(environment);
 }
Example #38
0
 public void Configure(ConfigurationContext context)
 {
     _configuration = context.Configuration.GetSection("ApplicationServices");
 }
Example #39
0
        public Tests()
        {
            var ctx = new ConfigurationContext();

            _sut = new ResourceSynchronizer(ctx, new QueryExecutor(ctx), new NullLogger());
        }
Example #40
0
 private void ConfigureListeners(ConfigurationContext context)
 {
     _reportListener = ConfigureQueueListener(context, "ErrorReports", "ErrorReportEvents");
     _eventProcessor = ConfigureQueueListener(context, "ErrorReportEvents", "ErrorReportEvents");
 }
Example #41
0
        internal static ISecurityCacheProvider GetSecurityCacheProvider(ConfigurationContext context)
        {
            SecurityCacheProviderFactory factory = new SecurityCacheProviderFactory(context);

            return(factory.GetSecurityCacheProvider());
        }
 /// <summary>
 /// Creates new instance of the class.
 /// </summary>
 /// <param name="configurationContext">Configuration settings.</param>
 /// <param name="queryExecutor">Executor of the queries.</param>
 /// <param name="logger">Logging matters.</param>
 public ResourceSynchronizer(ConfigurationContext configurationContext, IQueryExecutor queryExecutor, ILogger logger)
 {
     _configurationContext = configurationContext;
     _queryExecutor        = queryExecutor;
     _logger = logger;
 }
 private static void AddToChildren(IConfigSet configSet, ConfigurationContext context, IServiceHostSettings service)
 {
     foreach (var childConfigSet in configSet.ChildConfigSets)
     {
         var c = childConfigSet;
         var childService = service.CreateChild(context, ref c);
         AddToChildren(c, context, childService);
     }
 }
Example #44
0
        public static IEnvironmentParameter CreateParameters(this IEnvironment environment, ConfigurationContext context, string name, bool isSecureString)
        {
            var substitutionParameter = context.EnvironmentParameters.Create();

            substitutionParameter.EnvironmentNameId = environment.Id;
            substitutionParameter.Environment       = environment;
            substitutionParameter.Name           = name;
            substitutionParameter.IsSecureString = isSecureString;
            return(substitutionParameter);
        }
 private static void CreateSubstitutionParameters(IServiceDescription service, ConfigurationContext context,
     string endpointName, IEndpoint endpoint)
 {
     if (endpointName == "custom")
     {
         foreach (var environment in service.ConfigSet.Environments)
         {
             foreach (var param in endpoint.Parameters)
             {
                 var addressOverride = string.Format("{0}_{1}", service.Name, param.Name);
                 var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => string.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase));
                 if (overrideProp.IsNull())
                     environment.CreateSubstitutionParameters(context, addressOverride);
             }
         }
     }
 }
Example #46
0
 /// <summary>
 /// Creates new instance of the class.
 /// </summary>
 /// <param name="configurationContext">Configuration settings.</param>
 public ResourceRepository(ConfigurationContext configurationContext)
 {
     _enableInvariantCultureFallback = configurationContext.EnableInvariantCultureFallback;
 }
 public static void AddParameter(this IEndpoint endpoint, ConfigurationContext context, string parameterName, string parameterValue, bool isSubstitutionParameter,string description)
 {
     var parameter = context.EndpointParameters.Create();
     parameter.Name = parameterName;
     parameter.EndpointNameId = endpoint.Id;
     parameter.Endpoint = endpoint;
     parameter.ConfigurableForEachEnvironment = isSubstitutionParameter;
     parameter.IsPerService = isSubstitutionParameter;
     parameter.ItemValue = "{0}";
     parameter.Description = description;
     endpoint.Parameters.Add(parameter);
     AddToChildren(endpoint.ServiceDescription, context, endpoint);
     if (!isSubstitutionParameter) return;
     foreach (var environment in endpoint.ServiceDescription.ConfigSet.Environments)
     {
         var addressOverride = string.Format("{0}_{1}", endpoint.ServiceDescription.Name, parameterName);
         var overrideProp = environment.SubstitutionParameters.SingleOrDefault(x => String.Equals(x.Name, addressOverride, StringComparison.OrdinalIgnoreCase));
         if (overrideProp.IsNull())
             overrideProp=environment.CreateSubstitutionParameters(context, addressOverride);
         overrideProp.Description = description;
         if (parameter.SubstitutionParameters!=null) parameter.SubstitutionParameters=new List<ISubstitutionParameter>();
         if(!parameter.SubstitutionParameters.Contains(overrideProp))
             parameter.SubstitutionParameters.Add(overrideProp);
     }
 }
Example #48
0
		public BusBuilder()
		{
			_configurationContext = new ConfigurationContext();
		}
 public static IEndpoint CreateChild(this IEndpoint endpoint, ConfigurationContext context, ref IServiceDescription service)
 {
     var child = context.Endpoints.Create();
     child.Name = endpoint.Name;
     child.ServiceNameId = service.Id;
     child.ServiceDescription = service;
     context.SaveChanges();
     foreach (var endpointParameter in endpoint.Parameters)
     {
         var parameter = CreateChild(endpointParameter, context, child);
         child.Parameters.Add(parameter);
     }
     return child;
 }
Example #50
0
 public ConfigurationController(ConfigurationContext configurationContext)
 {
     _configurationContext = configurationContext;
 }
Example #51
0
 public void Configure(ConfigurationContext context, ServiceConfigurationBuilder <A> builder)
 {
     throw new InvalidOperationException("my exception");
 }
Example #52
0
 public GuiaRepository(ConfigurationContext context) : base(context)
 {
     _context = context;
 }
 private ConfigurationContext CreateContext(string xmlToUse)
 {
     XmlTextReader xmlReader = new XmlTextReader(new StringReader(xmlToUse));
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(ConfigurationSettings));
     ConfigurationSettings configurationSettings = xmlSerializer.Deserialize(xmlReader) as ConfigurationSettings;
     ConfigurationDictionary dictionary = new ConfigurationDictionary();
     dictionary.Add(ConfigurationSettings.SectionName, configurationSettings);
     ConfigurationContext context = new ConfigurationContext(dictionary);
     return context;
 }
Example #54
0
 public Optimizer(ConfigurationContext context, BracketTree bracket)
 {
     _context = context;
     _bracket = bracket;
 }
 public MockTransformer(ProviderData providerData, ConfigurationContext context)
 {
     this.context = context;
     this.providerData = providerData;
 }
Example #56
0
 public PetRepository(ConfigurationContext db)
 {
     _db = db;
 }
Example #57
0
 public IndividualRepository(ConfigurationContext db)
 {
     _db = db;
 }
Example #58
0
        public static ISubstitutionParameter EnsureDataCentersKey(this IEnvironment env, ConfigurationContext context, ConfigurationSettings settings)
        {
            var serviceHost    = env.ConfigSet.ServiceHosts.SingleOrDefault(sh => sh.Name == settings.DataCenterServiceHostName);
            var datacentersKey = serviceHost.Parameters.SingleOrDefault(shp => string.Equals(shp.Name, "datacenters", StringComparison.OrdinalIgnoreCase));

            if (datacentersKey.IsNull())
            {
                datacentersKey           = serviceHost.CreateParameter(context, "datacenters", false, true);
                datacentersKey.ItemValue = "{0}";
                if (datacentersKey.IsEnvironmental)
                {
                    foreach (var environment in serviceHost.ConfigSet.Environments)
                    {
                        environment.CreateSubstitutionParameters(context, serviceHost.Name + "_" + datacentersKey.Name);
                    }
                }
            }

            var envParam =
                env.SubstitutionParameters.SingleOrDefault(p => p.Name == GetDataCentersEnvironmentKey(datacentersKey));

            if (envParam.IsNull())
            {
                envParam = env.CreateSubstitutionParameters(context, GetDataCentersEnvironmentKey(datacentersKey));
            }
            Logging.DebugMessage("created datacenter keys for {0} in {1}", settings.DataCenterServiceHostName, settings.Environment);
            return(envParam);
        }
 public void Configure(ConfigurationContext context, ServiceConfigurationBuilder <A> builder)
 {
     builder.IgnoreImplementation();
 }
Example #60
0
 public CategoriesTests()
 {
     ConfigurationContext.Setup(cfg => cfg.TypeFactory.ForQuery <DetermineDefaultCulture.Query>().SetHandler <DetermineDefaultCulture.Handler>());
 }