예제 #1
0
        /// <summary>
        /// Gets the property mapper
        /// </summary>
        /// <returns></returns>
        public IYqlPropertyMapper GetPropertyMapper()
        {
            // get the config for the assembly
            var assemblyConfig = _assemblyConfigurationManager.GetAssemblyConfiguration(GetType());

            // return the config section
            return(assemblyConfig.CustomSections.FirstOrDefault(c =>
                                                                c.GetType() == typeof(YqlQueryConfigurationSection)) as YqlQueryConfigurationSection);
        }
예제 #2
0
        /// <summary>
        /// Gets a CSV column provider
        /// </summary>
        /// <returns></returns>
        public ICsvColumnProvider GetColumnProvider()
        {
            // get the config for the assembly
            var assemblyConfig = _assemblyConfigurationManager.GetAssemblyConfiguration(GetType());

            // return the config section
            return(assemblyConfig.CustomSections.FirstOrDefault(c =>
                                                                c.GetType() == typeof(CsvQueryConfigurationSection)) as CsvQueryConfigurationSection);
        }
예제 #3
0
        /// <summary>
        /// Initializes the module from configuration
        /// </summary>
        public virtual void Initialize()
        {
            // get the configuration for the assembly
            var assemblyConfiguration =
                _assemblyConfigurationManager.GetAssemblyConfiguration(GetType().Assembly);

            // add registrations to container
            if (assemblyConfiguration != null)
                assemblyConfiguration.Registrations.AddRegistrationsToContainer(_container);
        }
예제 #4
0
        /// <summary>
        /// Instantiates an <see cref="EmailAlertsAppSettings"/>
        /// </summary>
        /// <param name="assemblyConfigurationManager"></param>
        public EmailAlertsAppSettings(IAssemblyConfigurationManager assemblyConfigurationManager)
        {
            // get configuration for this assembly
            var configuration = assemblyConfigurationManager.GetAssemblyConfiguration(GetType());

            // set feed name for PennyPicks
            _pennyPicksFeedName = configuration.Settings.GetSetting(PennyPicksFeedNameKey, DefaultPennyPicksFeedName);

            // set stock data provider name for PennyPicks
            _pennyPicksStockDataProviderName =
                configuration.Settings.GetSetting(PennyPicksStockDataProviderNameKey, DefaultPennyPicksStockDataProviderName);
        }
        /// <summary>
        /// Instantiates a <see cref="YahooMarketDataAppSettings"/>
        /// </summary>
        /// <param name="assemblyConfigurationManager"></param>
        public YahooMarketDataAppSettings(IAssemblyConfigurationManager assemblyConfigurationManager)
        {
            // check that the app settings provider is set
            if (assemblyConfigurationManager == null)
            {
                throw new ArgumentNullException("assemblyConfigurationManager");
            }

            var assemblyConfig = assemblyConfigurationManager.GetAssemblyConfiguration(GetType());

            if (assemblyConfig != null)
            {
                // get the format of the yql url
                _yqlUrlFormat = assemblyConfig.Settings.GetSetting(YqlEndpointSettingName, DefaultYqlEndpoint);
                if (string.IsNullOrWhiteSpace(_yqlUrlFormat))
                {
                    throw new EndpointFormatNotFoundException("YQL");
                }

                // get flag indicating whether or not to include diagnostics data in the results of a YQL query
                _yqlIncludeDiagnostics = assemblyConfig.Settings.GetSetting(IncludeDiagnosticsSettingName, true);

                // get flag indicating whether or not to include diagnostics data in the results of a YQL query
                _yqlTableBlockedRegex =
                    assemblyConfig.Settings.GetSetting(YqlTableBlockedMessageSettingName,
                                                       DefaultYqlTableBlockedMessage);

                // get the YQL select for stocks
                _yqlStockSelect =
                    assemblyConfig.Settings.GetSetting(YqlStockSelectSettingName,
                                                       DefaultYqlStockSelectFormat);

                // get the YQL select for quotes
                _yqlMultiStockQuoteSelect =
                    assemblyConfig.Settings.GetSetting(YqlMultiQuoteStockSelectSettingName,
                                                       DefaultYqlMultiStockQuoteSelectFormat);

                // get the format of the csv url
                _csvUrlFormat = assemblyConfig.Settings.GetSetting(CsvEndpointSettingName, DefaultCsvEndpoint);
                if (string.IsNullOrWhiteSpace(_csvUrlFormat))
                {
                    throw new EndpointFormatNotFoundException("CSV");
                }
            }
            else
            {
                // use defaults for all settings
                _yqlUrlFormat          = DefaultYqlEndpoint;
                _yqlIncludeDiagnostics = true;
                _yqlTableBlockedRegex  = DefaultYqlTableBlockedMessage;
                _csvUrlFormat          = DefaultCsvEndpoint;
            }
        }
예제 #6
0
        /// <summary>
        /// Instantiates an <see cref="EmailAlertsAppSettings"/>
        /// </summary>
        /// <param name="assemblyConfigurationManager"></param>
        public EmailAlertsAppSettings(IAssemblyConfigurationManager assemblyConfigurationManager)
        {
            // get configuration for this assembly
            var configuration = assemblyConfigurationManager.GetAssemblyConfiguration(GetType());

            // set feed name for PennyPicks
            _pennyPicksFeedName = configuration.Settings.GetSetting(PennyPicksFeedNameKey, DefaultPennyPicksFeedName);

            // set stock data provider name for PennyPicks
            _pennyPicksStockDataProviderName =
                configuration.Settings.GetSetting(PennyPicksStockDataProviderNameKey, DefaultPennyPicksStockDataProviderName);
        }
        /// <summary>
        /// Instantiates a <see cref="YahooMarketDataAppSettings"/>
        /// </summary>
        /// <param name="assemblyConfigurationManager"></param>
        public YahooMarketDataAppSettings(IAssemblyConfigurationManager assemblyConfigurationManager)
        {
            // check that the app settings provider is set
            if (assemblyConfigurationManager == null)
                throw new ArgumentNullException("assemblyConfigurationManager");

            var assemblyConfig = assemblyConfigurationManager.GetAssemblyConfiguration(GetType());
            if (assemblyConfig != null)
            {
                // get the format of the yql url
                _yqlUrlFormat = assemblyConfig.Settings.GetSetting(YqlEndpointSettingName, DefaultYqlEndpoint);
                if (string.IsNullOrWhiteSpace(_yqlUrlFormat))
                    throw new EndpointFormatNotFoundException("YQL");

                // get flag indicating whether or not to include diagnostics data in the results of a YQL query
                _yqlIncludeDiagnostics = assemblyConfig.Settings.GetSetting(IncludeDiagnosticsSettingName, true);

                // get flag indicating whether or not to include diagnostics data in the results of a YQL query
                _yqlTableBlockedRegex =
                    assemblyConfig.Settings.GetSetting(YqlTableBlockedMessageSettingName,
                                                       DefaultYqlTableBlockedMessage);

                // get the YQL select for stocks
                _yqlStockSelect =
                    assemblyConfig.Settings.GetSetting(YqlStockSelectSettingName,
                                                       DefaultYqlStockSelectFormat);

                // get the YQL select for quotes
                _yqlMultiStockQuoteSelect =
                    assemblyConfig.Settings.GetSetting(YqlMultiQuoteStockSelectSettingName,
                                                       DefaultYqlMultiStockQuoteSelectFormat);

                // get the format of the csv url
                _csvUrlFormat = assemblyConfig.Settings.GetSetting(CsvEndpointSettingName, DefaultCsvEndpoint);
                if (string.IsNullOrWhiteSpace(_csvUrlFormat))
                    throw new EndpointFormatNotFoundException("CSV");
            }
            else
            {
                // use defaults for all settings
                _yqlUrlFormat = DefaultYqlEndpoint;
                _yqlIncludeDiagnostics = true;
                _yqlTableBlockedRegex = DefaultYqlTableBlockedMessage;
                _csvUrlFormat = DefaultCsvEndpoint;
            }
        }