当前位置: 首页>>代码示例>>C#>>正文


C# IConfigurationRepository.GetConfigurationValue方法代码示例

本文整理汇总了C#中IConfigurationRepository.GetConfigurationValue方法的典型用法代码示例。如果您正苦于以下问题:C# IConfigurationRepository.GetConfigurationValue方法的具体用法?C# IConfigurationRepository.GetConfigurationValue怎么用?C# IConfigurationRepository.GetConfigurationValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfigurationRepository的用法示例。


在下文中一共展示了IConfigurationRepository.GetConfigurationValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log4NetLoggingService

 public Log4NetLoggingService(IConfigurationRepository configurationRepository, IContextService contextService)
 {
     if (configurationRepository == null) throw new ArgumentNullException("ConfigurationRepository");
     if (contextService == null) throw new ArgumentNullException("ContextService");
     _configurationRepository = configurationRepository;
     _contextService = contextService;
     _log4netConfigFileName = _configurationRepository.GetConfigurationValue<string>("Log4NetSettingsFile");
     if (string.IsNullOrEmpty(_log4netConfigFileName))
     {
         throw new ApplicationException("Log4net settings file missing from the configuration source.");
     }
     SetupLogger();
 }
开发者ID:FCMA-OSS,项目名称:RewardRecognition,代码行数:13,代码来源:Log4NetLoggingService.cs

示例2: Main

        static void Main(string[] args)
        {
            try
            {
                // The configurationRepository is intended to abstract the configurationManager type and allow
                // for different configuration options to be applied. For example, a DatabaseConfigurationRepository could be provided
                // if the requirement is to take reference values from a database.
                configurationRepository = new ConfigFileConfigurationRepository();
                loggingService = new Log4NetLoggingService(configurationRepository, new ThreadContextService());

                GovernmentGatewayEnvironment gatewayEnv = GovernmentGatewayEnvironment.localtestservice;

                //GovTalkMessageHelper helper = new GovTalkMessageHelper(configurationRepository, loggingService);

                //////// Optionally, set this to a valid filepath for a CSV that contains GiftAid data in an acceptable format.
                string csvFile = configurationRepository.GetConfigurationValue<string>("TempFolder") + "testdata.csv";

                #region Testing
                //TestGovTalkMessageCreation(csvFile, outputFilename);

                //XmlDocument LiveXml = new XmlDocument();
                //LiveXml.PreserveWhitespace = true;
                //LiveXml.Load(outputFilename);
                //XmlDocument LocalTestXml = new XmlDocument();
                //LocalTestXml.PreserveWhitespace = true;
                //LocalTestXml = helper.UpdateMessageForLocalTest(LiveXml);
                //LocalTestXml.Save(@"C:\Temp\Localsend.xml");
                #endregion Testing

                //// Create a GovTalkMessage and save the Xml to disk

                string outputFilename = DemonstrateCreateSubmitRequest(loggingService, configurationRepository, csvFile);

                XmlDocument submitMessageXml = new XmlDocument();

                ////// It is important if the XML message is being loaded from disk to preserve whitespace, otherwise the IRmark will be out for non-compressed files
                submitMessageXml.PreserveWhitespace = true;
                submitMessageXml.Load(outputFilename);

                XmlDocument submitMessageReply = DemonstrateSendMessage(loggingService, submitMessageXml, gatewayEnv);
                //XmlDocument submitMessageReply = new XmlDocument();
                //pollMessageReply.Load(@"C:\Temp\20151020110837.xml");

                DemonstrateReadMessage(loggingService, submitMessageReply);
            }
            catch (System.Net.WebException wex)
            {
                loggingService.LogError(wex.Source, "Exception occured in connecting to remote machine", wex);

                //Console.WriteLine("Exception occured in connecting to remote machine");
                //Console.WriteLine(wex.InnerException.Message);
                //Console.WriteLine(wex.Message);
            }
            catch (Exception ex)
            {
                loggingService.LogError(ex.Source, ex.Message, ex);
                //Console.WriteLine(ex);
            }
            finally
            {
                Console.ReadKey();
            }
        }
开发者ID:LalithaSharma,项目名称:gail,代码行数:63,代码来源:DemoConsole.cs

示例3: DemonstrateCreateSubmitRequest

        /// <summary>
        /// Shows how to create a Submit Request GovTalkMessage, the basic type for submitting a GiftAid claim.
        /// If the message is very large it can be compressed, or compression can be chosen at the start of the process.
        /// Password and IRmark are added after the message is created.
        /// </summary>
        /// <param name="loggingService"></param>
        static string DemonstrateCreateSubmitRequest(ILoggingService loggingService, IConfigurationRepository configurationRepository, string giftAidDataSourceCsvFile)
        {
            // Assign a reference data source
            ReferenceDataManager.SetSource(ReferenceDataManager.SourceTypes.ConfigFile);

            // Set logger for the repaymentPopulater
            DataTableRepaymentPopulater.SetLogger(loggingService);

            // Assign a source for the GiftAid repayments data
            // If a filepath has been passed in, the DataHelpers method will make a datatable from a CSV source
            // with a valid set of columns. Otherwise, grab a datatable from a database or some other source
            // If the repaymentpopulater is not given a datatable, the submission message will have no repayments in it
            if (!string.IsNullOrEmpty(giftAidDataSourceCsvFile))
                DataTableRepaymentPopulater.GiftAidDonations = DataHelpers.GetDataTableFromCsv(giftAidDataSourceCsvFile, true);

            GovTalkMessageCreator submitMessageCreator = new GovTalkMessageCreator(new SubmitRequestMessageBuilder(loggingService), loggingService);

            submitMessageCreator.CreateGovTalkMessage();

            GovTalkMessage submitMessage = submitMessageCreator.GetGovTalkMessage();

            // Set a password if not using the password hard-coded in the configuration source
            GovTalkMessageHelper helper = new GovTalkMessageHelper(configurationRepository, loggingService);
            helper.SetPassword(submitMessage, "weirdpassword");

            XmlDocument submitMessageXml = submitMessageCreator.SerializeGovTalkMessage();

            GovTalkMessageHelper gtmHelper = new GovTalkMessageHelper(configurationRepository, loggingService);

            XmlDocument irMarkedMessageXml = gtmHelper.SetIRmark(submitMessageXml);

            // If the message is too big, compress it

            // byte[] xmlDocumentSize = xd.XmlToBytes();

            // if (xmlDocumentSize.Length > 1000000)
            // {
            //    XmlDocument compressedVersion = submitMessageCreator.CompressClaim();
            //    outputXmlDocument = GovTalkMessageHelper.SetIRmark(compressedVersion);
            // }

            // Optionally, create a filename using this helper class

            string outputFilename;
            string tempDirectory = configurationRepository.GetConfigurationValue<string>("TempFolder");

            GovTalkMessageFileName FileNamer = new GovTalkMessageFileName.FileNameBuilder()
                .AddLogger(loggingService)
                .AddMessageIntention("GatewaySubmission")
                .AddFilePath(tempDirectory)
                .AddTimestamp(DateTime.Now.ToString("yyyyMMddHHmmss"))
                .AddEnvironment("local")
                .AddCustomNamePart("EmptyRepayment")
                .BuildFileName();

            outputFilename = FileNamer.ToString();

            irMarkedMessageXml.Save(outputFilename);

            return outputFilename;
        }
开发者ID:LalithaSharma,项目名称:gail,代码行数:67,代码来源:DemoConsole.cs


注:本文中的IConfigurationRepository.GetConfigurationValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。