コード例 #1
0
 public void Add(ProviderSettings provider)
 {
     if (provider != null)
     {
         provider.UpdatePropertyCollection();
         BaseAdd(provider);
     }
 }
 public ProtectedConfigurationProvider(ProviderSettings ps)
 {
     Name = (string)ps["name"];
     _sessionKey = (string)ps["sessionKey"];
     var value = ps["useOAEP"];
     _useOAEP = value != null && bool.Parse(value.ToString());
     _keyContainerName = (string)ps["keyContainerName"];
     var value2 = ps["useMachineContainer"];
     _useMachineContainer = value2 != null && bool.Parse(value2.ToString());
     _cspProviderName = (string)ps["cspProviderName"];
 }
コード例 #3
0
 public void Save()
 {
     using (var reg = new ProviderSettings(providerDescriptor.ProviderKey))
     {
         reg.Enabled = IsEnabled;
         reg.SetValue("PinCode", PinCode);
     }
     providerDescriptor.IsEnabled = IsEnabled;
     providerDescriptor.Data["PinCode"] = PinCode;
     ((IWebApiProviderDescriptor)providerDescriptor).Initialize();
 }
コード例 #4
0
            private static void AdjustClusterConfiguration(ClusterConfiguration config)
            {
                var settings = new Dictionary <string, string>();

                // get initial settings from configs
                ProviderSettings.WriteProperties(settings);
                ProviderSettings.WriteDataGeneratingConfig(settings);
                ConfigureCustomQueueBalancer(settings, config);

                // register stream provider
                config.Globals.RegisterStreamProvider <EventDataGeneratorStreamProvider>(StreamProviderName, settings);
                config.Globals.RegisterStorageProvider <MemoryStorage>("PubSubStore");
            }
コード例 #5
0
 protected override void LoadSettings()
 {
     this.IsNotifying = false;
     using (var reg = new ProviderSettings(this.providerDescriptor.ProviderKey))
     {
         this.IsEnabled = reg.Enabled;
         this.PinCode   = reg.GetOrCreate("PinCode", "");
     }
     this.providerDescriptor.IsEnabled       = this.IsEnabled;
     this.providerDescriptor.Data["PinCode"] = this.PinCode;
     this.IsNotifying = true;
     this.Refresh();
 }
コード例 #6
0
        public ProtectedConfigurationProvider(ProviderSettings ps)
        {
            Name        = (string)ps["name"];
            _sessionKey = (string)ps["sessionKey"];
            var value = ps["useOAEP"];

            _useOAEP          = value != null && bool.Parse(value.ToString());
            _keyContainerName = (string)ps["keyContainerName"];
            var value2 = ps["useMachineContainer"];

            _useMachineContainer = value2 != null && bool.Parse(value2.ToString());
            _cspProviderName     = (string)ps["cspProviderName"];
        }
コード例 #7
0
        public void InstantiateProvider()
        {
            ProviderSettings providerSettings = new ProviderSettings("Custom", "Remotion.UnitTests::Configuration.FakeProvider");

            providerSettings.Parameters.Add("description", "The Description");

            ProviderBase providerBase = _providerHelper.InstantiateProvider(providerSettings, typeof(FakeProviderBase), typeof(IFakeProvider));

            Assert.That(providerBase, Is.Not.Null);
            Assert.IsInstanceOf(typeof(FakeProvider), providerBase);
            Assert.That(providerBase.Name, Is.EqualTo("Custom"));
            Assert.That(providerBase.Description, Is.EqualTo("The Description"));
        }
コード例 #8
0
            private WebEventProvider GetProviderInstance(string providerName)
            {
                object obj2 = this._instances[providerName];

                if (obj2 == null)
                {
                    return(null);
                }
                ProviderSettings settings = obj2 as ProviderSettings;

                if (settings != null)
                {
                    WebEventProvider provider;
                    Type             c = BuildManager.GetType(settings.Type, false);
                    if (typeof(IInternalWebEventProvider).IsAssignableFrom(c))
                    {
                        provider = (WebEventProvider)HttpRuntime.CreateNonPublicInstance(c);
                    }
                    else
                    {
                        provider = (WebEventProvider)HttpRuntime.CreatePublicInstance(c);
                    }
                    ProcessImpersonationContext context = new ProcessImpersonationContext();
                    try
                    {
                        provider.Initialize(settings.Name, settings.Parameters);
                    }
                    catch (ConfigurationErrorsException)
                    {
                        throw;
                    }
                    catch (ConfigurationException exception)
                    {
                        throw new ConfigurationErrorsException(exception.Message, settings.ElementInformation.Properties["type"].Source, settings.ElementInformation.Properties["type"].LineNumber);
                    }
                    catch
                    {
                        throw;
                    }
                    finally
                    {
                        if (context != null)
                        {
                            ((IDisposable)context).Dispose();
                        }
                    }
                    this._instances[providerName] = provider;
                    return(provider);
                }
                return(obj2 as WebEventProvider);
            }
コード例 #9
0
            private static Dictionary <string, string> BuildProviderSettings()
            {
                var settings = new Dictionary <string, string>();

                // get initial settings from configs
                ProviderSettings.WriteProperties(settings);
                EventHubConfig.Value.WriteProperties(settings);
                CheckpointerSettings.WriteProperties(settings);

                // add queue balancer setting
                settings.Add(PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.StaticClusterConfigDeploymentBalancer.AssemblyQualifiedName);

                return(settings);
            }
コード例 #10
0
ファイル: Logger.cs プロジェクト: shekky/cuttingedge.logging
        private static LoggingProviderBase CreateNewProviderInstance(ProviderSettings settings)
        {
            Type providerType = GetProviderType(settings);

            try
            {
                return((LoggingProviderBase)Activator.CreateInstance(providerType));
            }
            catch (Exception ex)
            {
                throw new ArgumentException(
                          SR.TypeCouldNotBeCreatedForProvider(settings.Name, providerType, ex.Message), ex);
            }
        }
コード例 #11
0
        /// <summary>
        /// Adds the element to collection.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="attributes">The attributes.</param>
        protected virtual void AddElementToCollection(string name, XmlAttributeCollection attributes)
        {
            ProviderSettings newProviderSettings = new ProviderSettings(name, attributes["type"].Value);

            foreach (XmlAttribute attribute in attributes)
            {
                if (attribute.Name != "name" && attribute.Name != "type")
                {
                    newProviderSettings.Parameters.Add(attribute.Name, attribute.Value);
                }
            }

            _Providers.Add(newProviderSettings.Name, newProviderSettings);
        }
コード例 #12
0
 public static ExcelTerm CreateExcelTerm(string source,
                                         string target,
                                         string approved,
                                         ProviderSettings providerSettings)
 {
     return(new ExcelTerm
     {
         Source = source,
         SourceCulture = providerSettings.SourceLanguage,
         Target = target,
         TargetCulture = providerSettings.TargetLanguage,
         Approved = approved
     });
 }
コード例 #13
0
    protected void btnSetCC_Click(object sender, EventArgs e)
    {
        // Get the current configuration file.
        System.Configuration.Configuration       config  = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        Commerce.Providers.PaymentServiceSection section = (Commerce.Providers.PaymentServiceSection)config.GetSection("PaymentService");

        //load up the ConfigSection
        ProviderSettings settings = new ProviderSettings();

        try {
            string userName     = txtCCUserName.Text;
            string password     = txtCCPassword.Text;
            string key          = txtCCKey.Text;
            string providerName = ddlCCProvider.SelectedValue;

            section.AcceptCreditCards = chkAcceptCC.Checked;
            //section.CurrencyCode = ddlCurrencyType.SelectedValue;
            section.Providers.Clear();
            //apply the settings based on the provider
            if (providerName == "PayPalPaymentProvider")
            {
                section.DefaultProvider = "PayPalPaymentProvider";
                settings.Name           = "PayPalPaymentProvider";
                settings.Parameters.Add("type", "Commerce.Providers.PayPalPaymentProvider");
                settings.Parameters.Add("apiUserName", txtPPAPIAccount.Text.Trim());
                settings.Parameters.Add("apiPassword", txtPPAPIPassword.Text.Trim());
                settings.Parameters.Add("signature", txtPPAPISignature.Text.Trim());
                bool isLive = !chkUsePPSandbox.Checked;
                settings.Parameters.Add("isLive", isLive.ToString());
                section.Providers.Add(settings);
            }
            else
            {
                section.DefaultProvider = providerName;
                settings.Name           = providerName;
                settings.Parameters.Add("type", "Commerce.Providers." + providerName);
                settings.Parameters.Add("serviceUserName", txtPPAPIAccount.Text);
                settings.Parameters.Add("servicePassword", txtPPAPIPassword.Text);
                settings.Parameters.Add("transactionKey", txtCCKey.Text);
                settings.Parameters.Add("serverURL", txtCCUrl.Text);
                settings.Parameters.Add("currencyCode", ddlCurrencyType.SelectedValue);
                section.Providers.Add(settings);
            }
            config.Save();
            ResultMessage5.ShowSuccess("Credit Card Settings Saved");
        }
        catch (Exception x) {
            ResultMessage5.ShowFail("Cannot write to the Web.Config file; in order to have the application update the configuration, you have to allow write access to the ASNET account (or NETWORK SERVICE) and make sure the file is not marked as Read Only");
        }
    }
コード例 #14
0
        public async Task SendAsync(SendMailCommand mailDto, ProviderSettings settings)
        {
            string cacheTokenName = $"{settings.Name ?? ""}_token";
            var    token          = _memoryCache.Get <Token>(cacheTokenName);

            if (token == null || token.HasExpired)
            {
                token = await _authService.GetTokenAsync();

                _memoryCache.Set(cacheTokenName, token);
            }

            string from = mailDto.From ?? settings.DefaultFrom;

            if (string.IsNullOrEmpty(from))
            {
                throw new Exception("From is required");
            }

            await $"{_azureAdOptions.GraphResource}/beta/users/{from}/sendMail"
            .WithOAuthBearerToken(token.AccessToken)
            .PostJsonAsync(new
            {
                message = new {
                    subject = mailDto.Subject,
                    body    = new
                    {
                        contentType = mailDto.IsHtml ? "HTML" : "Text",
                        content     = mailDto.Body
                    },
                    toRecipients = mailDto.To?.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                                   .Select(v => new
                    {
                        emailAddress = new
                        {
                            address = v
                        }
                    }),
                    ccRecipients = (IEnumerable)mailDto.Cc?.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                                   .Select(v => new
                    {
                        emailAddress = new
                        {
                            address = v
                        }
                    }) ?? new string[] {}
                },
                saveToSentItems = "false"
            });
        }
コード例 #15
0
        protected void EnsureApplicationNameSpecified(out string appName)
        {
            string mem   = null;
            string roles = null;

            // Membership
            try
            {
                MembershipSection section          = (MembershipSection)WebConfigurationManager.GetSection("system.web/membership");
                string            defaultProvider  = section.DefaultProvider;
                ProviderSettings  providerSettings = section.Providers[defaultProvider];
                mem = providerSettings.Parameters["applicationName"];
            }
            catch (Exception)
            {
                throw new Exception(Membership_missing_application_name);
            }
            if (null == mem)
            {
                throw new Exception(Membership_missing_application_name);
            }


            // Roles
            try
            {
                RoleManagerSection section          = (RoleManagerSection)WebConfigurationManager.GetSection("system.web/roleManager");
                string             defaultProvider  = section.DefaultProvider;
                ProviderSettings   providerSettings = section.Providers[defaultProvider];
                roles = providerSettings.Parameters["applicationName"];
            }
            catch (Exception)
            {
                throw new Exception(Roles_missing_application_name);
            }
            if (null == roles)
            {
                throw new Exception(Roles_missing_application_name);
            }


            // match?
            if (roles != mem)
            {
                throw new Exception(Application_names_must_match);
            }

            appName = mem;
        }
コード例 #16
0
        private static TProvider InstantiateProvider <TProvider>(ProviderSettings settings) where TProvider : ProviderBase
        {
            try
            {
                var typeSetting = settings.Type == null ? null : settings.Type.Trim();

                if (string.IsNullOrEmpty(typeSetting))
                {
                    throw new ArgumentException("Type_Name_Required_For_Provider_Exception (Key present in resx file with same string)");
                }

                var providerType = Type.GetType(settings.Type, true, true);

                if (!typeof(TProvider).IsAssignableFrom(providerType))
                {
                    throw new ArgumentException("Provider must implement the class {0}.".FormatWith(typeof(TProvider)));
                }

                var provider = (TProvider)Activator.CreateInstance(providerType);

                var parameters = settings.Parameters;
                var config     = new NameValueCollection(parameters.Count, StringComparer.Ordinal);

                foreach (string key in parameters)
                {
                    config[key] = parameters[key];
                }

                provider.Initialize(settings.Name, config);

                return(provider);
            }
            catch (Exception e)
            {
                if (e is ConfigurationException)
                {
                    throw;
                }

                var typePropertyInformation = settings.ElementInformation.Properties["type"];

                if (typePropertyInformation == null)
                {
                    throw;
                }

                throw new ConfigurationErrorsException(e.Message, typePropertyInformation.Source, typePropertyInformation.LineNumber);
            }
        }
コード例 #17
0
ファイル: Logger.cs プロジェクト: shekky/cuttingedge.logging
        // Throws a ConfigurationException (or a descendant) on failure.
        private static LoggingProviderBase InstantiateLoggingProvider(ProviderSettings settings)
        {
            try
            {
                var provider = CreateNewProviderInstance(settings);

                InitializeProvider(provider, settings);

                return(provider);
            }
            catch (Exception ex)
            {
                throw BuildMoreExpressiveException(ex, settings);
            }
        }
コード例 #18
0
        public MovieDataService(IConfiguration configuration)
        {
            this.configuration = configuration;

            this.maxRetryAttempts = this.configuration.GetValue(Constants.CONFIG_RETRY_MAX_ATTEMPTS, 3);
            var seconds = this.configuration.GetValue(Constants.CONFIG_RETRY_SECONDS_PAUSE_BETWEEN_FAILURES, 1);

            this.pauseBetweenFailures = TimeSpan.FromSeconds(seconds);
            this.timeoutSeconds       = this.configuration.GetValue(Constants.CONFIG_TIMEOUT_SECONDS, 10);

            var providerSettings = new ProviderSettings();

            this.configuration.Bind(nameof(ProviderSettings), providerSettings);
            this.providers = providerSettings.Providers;
        }
コード例 #19
0
        public static StreetviewProvider CreateProvider()
        {
            StreetviewProvider provider;

            settings = new ProviderSettings()
            {
                ApiKey    = "AIzaSyD1u1BGcJCUUGbzw1iXNpYKnK-wRSW2EfY", // If left blank, further requests and IP address can get blocked by Google.
                WorldSize = new Vector3(1000000, 1000000, 1000000),
                Size      = new Vector2(640, 640)                      // each tile must be a square for cube mapping to work
            };

            provider = new StreetviewProvider(settings);

            return(provider);
        }
コード例 #20
0
ファイル: Common.cs プロジェクト: m98proxy/GoogleHacks
        public static StreetviewProvider CreateProvider()
        {
            StreetviewProvider provider;
            ProviderSettings   settings;

            settings = new ProviderSettings()
            {
                ApiKey    = "", // If left blank, further requests and IP address can get blocked by Google.
                WorldSize = new Vector3(1000, 1000, 1000)
            };

            provider = new StreetviewProvider(settings);

            return(provider);
        }
コード例 #21
0
ファイル: OutputCache.cs プロジェクト: pmq20/mono_forked
        static OutputCacheProvider LoadProvider(ProviderSettings ps)
        {
            Type type = HttpApplication.LoadType(ps.Type, false);

            if (type == null)
            {
                throw new ConfigurationErrorsException(String.Format("Could not load type '{0}'.", ps.Type));
            }

            var ret = Activator.CreateInstance(type) as OutputCacheProvider;

            ret.Initialize(ps.Name, ps.Parameters);

            return(ret);
        }
コード例 #22
0
ファイル: AppCodeCompiler.cs プロジェクト: pmq20/mono_forked
        string FindProviderTypeName(ProfileSection ps, string providerName)
        {
            if (ps.Providers == null || ps.Providers.Count == 0)
            {
                return(null);
            }

            ProviderSettings pset = ps.Providers [providerName];

            if (pset == null)
            {
                return(null);
            }
            return(pset.Type);
        }
コード例 #23
0
            public void Should_not_throw_exception_when_data_parser_type_not_specified()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Get<string>("website"), Is.EqualTo(website));
            }
コード例 #24
0
            private static void AdjustClusterConfiguration(ClusterConfiguration config)
            {
                var settings = new Dictionary <string, string>();

                // get initial settings from configs
                ProviderSettings.WriteProperties(settings);
                ProviderSettings.WriteDataGeneratingConfig(settings);

                // add queue balancer setting
                settings.Add(PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.AssemblyQualifiedName);

                // register stream provider
                config.Globals.RegisterStreamProvider <EHStreamProviderForMonitorTests>(StreamProviderName, settings);
                config.Globals.RegisterStorageProvider <MemoryStorage>("PubSubStore");
            }
コード例 #25
0
            public void Should_return_false_if_the_setting_doesnt_exist()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Contains("somesetting"), Is.False);
            }
コード例 #26
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try {
                SetRegionCodeConfigurationProperties();
                taxServiceSettings = TaxService.FetchConfiguredTaxProviders();
                if (taxServiceSettings != null)
                {
                    foreach (ProviderSettings providerSettings in taxServiceSettings.ProviderSettingsCollection)
                    {
                        if (providerSettings.Name == typeof(RegionCodeTaxProvider).Name)
                        {
                            regionCodeConfigurationSettings = providerSettings;
                        }
                    }
                    if (regionCodeConfigurationSettings != null)
                    {
                        txtDefaultRate.Text = regionCodeConfigurationSettings.Parameters[RegionCodeTaxProvider.DEFAULT_RATE];
                    }
                }
                else
                {
                    taxServiceSettings = new TaxServiceSettings();
                }
                view = Utility.GetParameter("view");
                switch (view)
                {
                case "c":
                    pnlRegionCodeConfiguration.Visible = true;
                    pnlRegionCodeData.Visible          = false;
                    break;

                case "d":
                    LoadRegionCodeRates();
                    pnlRegionCodeData.Visible          = true;
                    pnlRegionCodeConfiguration.Visible = false;
                    break;

                default:
                    pnlRegionCodeConfiguration.Visible = true;
                    pnlRegionCodeData.Visible          = false;
                    break;
                }
            }
            catch (Exception ex) {
                Logger.Error(typeof(regioncodeconfiguration).Name + ".Page_Load", ex);
                base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
            }
        }
コード例 #27
0
 public bool Read(string location, Func <string, ProviderSettings> getTypesProviderByLocation)
 {
     _project  = null;
     _provider = getTypesProviderByLocation(location);
     if (_provider == null)
     {
         return(false);
     }
     _with = (IProvideVersionedTypes)_provider.TypesProvider;
     if (_with == null)
     {
         return(false);
     }
     _project = _with.Reader().Read(_provider.ProjectFile);
     return(_project != null);
 }
コード例 #28
0
            public void Should_return_default_generic_type_when_setting_name_is_null_or_empty_or_doesnt_exist(string settingName)
            {
                string website        = "http://www.johndoe.com";
                int    userId         = 1;
                string userFullname   = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary <string, string>();

                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                settings.Get <string>(settingName);
            }
コード例 #29
0
            public void Should_return_false_if_the_setting_doesnt_exist()
            {
                string website        = "http://www.johndoe.com";
                int    userId         = 1;
                string userFullname   = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary <string, string>();

                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Contains("somesetting"), Is.False);
            }
コード例 #30
0
            public void Should_return_a_count_of_settings()
            {
                string website        = "http://www.johndoe.com";
                int    userId         = 1;
                string userFullname   = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary <string, string>();

                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Count, Is.EqualTo(2));
            }
コード例 #31
0
            public void Should_not_throw_exception_when_data_parser_type_not_specified()
            {
                string website        = "http://www.johndoe.com";
                int    userId         = 1;
                string userFullname   = "John Doe";
                string dataParserType = "";

                var settingsAsDictionary = new Dictionary <string, string>();

                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Get <string>("website"), Is.EqualTo(website));
            }
コード例 #32
0
        public MovieService(
            IConfiguration configuration,
            IMovieDataService movieDataService,
            IStoreRepository storeRepository)
        {
            this.movieDataService = movieDataService;
            this.storeRepository  = storeRepository;
            var providerSettings = new ProviderSettings();

            if (configuration != null)
            {
                this.configuration = configuration;
                this.configuration.Bind(nameof(ProviderSettings), providerSettings);
                this.providers = providerSettings.Providers;
            }
        }
コード例 #33
0
		private Dictionary<string, ProviderSettings> GetProviders(string providerKey)
		{
			var result = new Dictionary<String, ProviderSettings>();
			using (ProviderDataContext dc = ProviderFactory.GetInstance<DataContextFactory>(ProviderRepositoryFactory.Instance.Providers[this.Parameters["dataContextProviderRepositoryName"]]).GetProviders<DataContextProviderBase>()[this.Parameters["dataContextProviderName"]].DataContext as ProviderDataContext)
			{
				foreach (ProviderValueObject provider in dc.Providers.Where(p => p.Key == providerKey).ToList()) {
					var newProviderSettings = new ProviderSettings(provider.Name,provider.Type);
					foreach (ProviderParameterValueObject parameter in dc.ProviderParameters.Where(p => p.FKProviders == provider.Id).ToList()) {
						newProviderSettings.Parameters.Add(parameter.Name, parameter.Value);
					}
					result.Add(newProviderSettings.Name, newProviderSettings);
				}
			}
			
			return result;
		}
コード例 #34
0
            private static void AdjustClusterConfiguration(ClusterConfiguration config)
            {
                var settings = new Dictionary <string, string>();

                // get initial settings from configs
                ProviderSettings.WriteProperties(settings);
                EventHubConfig.Value.WriteProperties(settings);
                CheckpointerSettings.WriteProperties(settings);

                // add queue balancer setting
                settings.Add(PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.ToString());

                // register stream provider
                config.Globals.RegisterStreamProvider <EHStreamProviderWithCreatedCacheList>(StreamProviderName, settings);
                config.Globals.RegisterStorageProvider <MemoryStorage>("PubSubStore");
            }
コード例 #35
0
            public void Should_throw_exception_if_type_is_interface()
            {
                string website        = "http://www.johndoe.com";
                int    userId         = 1;
                string userFullname   = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary <string, string>();

                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                var user = settings["user", typeof(IUser)];
            }
コード例 #36
0
            private static Dictionary <string, string> BuildProviderSettings()
            {
                var settings = new Dictionary <string, string>();

                // get initial settings from configs
                ProviderSettings.WriteProperties(settings);
                EventHubConfig.Value.WriteProperties(settings);
                CheckpointerSettings.WriteProperties(settings);

                // add queue balancer setting
                settings.Add(PersistentStreamProviderConfig.QUEUE_BALANCER_TYPE, StreamQueueBalancerType.DynamicClusterConfigDeploymentBalancer.ToString());

                // add pub/sub settting
                settings.Add(PersistentStreamProviderConfig.STREAM_PUBSUB_TYPE, StreamPubSubType.ImplicitOnly.ToString());
                return(settings);
            }
コード例 #37
0
            public void Should_throw_exception_if_type_is_interface()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                var user = settings["user", typeof(IUser)];
            }
 // Methods
 public void Add(ProviderSettings provider)
 {
 }
コード例 #39
0
 protected override void LoadSettings()
 {
     IsNotifying = false;
     using (var reg = new ProviderSettings(providerDescriptor.ProviderKey))
     {
         IsEnabled = reg.Enabled;
         PinCode = reg.GetOrCreate("PinCode", "");
     }
     providerDescriptor.IsEnabled = IsEnabled;
     providerDescriptor.Data["PinCode"] = PinCode;
     IsNotifying = true;
     Refresh();
 }
 private ProtectedConfigurationProvider InstantiateProvider(ProviderSettings ps)
 {
     return new ProtectedConfigurationProvider(ps);
 }
コード例 #41
0
            public void Should_return_a_count_of_settings()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                Assert.That(settings.Count, Is.EqualTo(2));
            }
コード例 #42
0
            public void Should_return_serialized_complex_type()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                var user = settings["user"];

                Assert.That(user, Is.EqualTo("id:1|name:John Doe"));
            }
コード例 #43
0
ファイル: ProjectHandler.cs プロジェクト: JamesTryand/OpenIDE
 public bool Read(string location, Func<string, ProviderSettings> getTypesProviderByLocation)
 {
     _project = null;
     _provider = getTypesProviderByLocation(location);
     if (_provider == null)
         return false;
     _with = (IProvideVersionedTypes) _provider.TypesProvider;
     if (_with == null)
         return false;
     _project = _with.Reader().Read(_provider.ProjectFile);
     return _project != null;
 }
コード例 #44
0
            public void Should_for_complex_types_use_default_parser_which_is_the_pipe_data_parser_when_data_parser_not_specified()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                var user = settings["user", typeof(User)];

                Assert.That(user.Id, Is.EqualTo(userId));
                Assert.That(user.Name, Is.EqualTo(userFullname));
            }
コード例 #45
0
            public void Should_return_true_and_the_setting_if_the_setting_exists()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                User user;
                var containsSettingName = settings.TryGet<User>("user", out user);

                Assert.That(containsSettingName, Is.True);
                Assert.That(user, Is.Not.Null);
            }
コード例 #46
0
            public void Should_return_false_and_the_default_value_of_the_setting_if_the_setting_doesnt_exist()
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                string invalidSetting;
                var containsSettingName = settings.TryGet<string>("invalidsetting", out invalidSetting);

                Assert.That(containsSettingName, Is.False);
                Assert.That(invalidSetting, Is.Null);
            }
コード例 #47
0
            public void Should_return_setting_with_specified_type_and_setting_name(Type settingType, string settingName)
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                if (settingType == typeof(string))
                {
                    Assert.That(settings[settingName, settingType], Is.EqualTo(website));
                }
                else
                {
                    var user = settings[settingName, settingType];

                    Assert.That(user.Id, Is.EqualTo(userId));
                    Assert.That(user.Name, Is.EqualTo(userFullname));
                }
            }
コード例 #48
0
            public void Should_return_default_type_when_setting_name_is_null_or_empty(string settingName)
            {
                string website = "http://www.johndoe.com";
                int userId = 1;
                string userFullname = "John Doe";
                string dataParserType = "CommonProvider.Data.PipeDelimitedDataParser, CommonProvider";

                var settingsAsDictionary = new Dictionary<string, string>();
                settingsAsDictionary.Add("website", website);
                settingsAsDictionary.Add("user", string.Format("id:{0}|name:{1}", userId, userFullname));

                var settings = new ProviderSettings(settingsAsDictionary, dataParserType);

                var setting = settings[settingName, typeof(string)];
            }