class1.cs

来自「应用框架的设计与实现的源代码(SAF) 《应用框架的设计与实现》随书源码」· CS 代码 · 共 36 行

CS
36
字号
using System;
using System.Configuration;
using Application.Configuration;
using SAF.Configuration;

namespace TestConsole
{
	/// <summary>
	/// The demo shows how to use SAF.Configuration service inside a program and
	/// how to use the custom configuration object defined for the business application
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			//get the configuraiton manager of Application.Configuration 
			AppConfigurationManager cm1 = (AppConfigurationManager)ConfigurationSettings.GetConfig("MyApplication");
			//retrieve the configuraiton data by calling the properties and methods of configuration manager.
			string connection = cm1.DatabaseConfig.GetDatabaseConnection();
			//these two calls involve the agents which retrieve the configuraiton data via web service
			//at http://localhost/ConfigurationData/ConfigurationService.asmx
			string customerQueueLocation = cm1.MessageQueueConfig.GetCustomerQueueLocation();
			string accountQueueLocation = cm1.MessageQueueConfig.GetAccountQueueLocation();
			
			//get the configuration manager of SAF.Configuration
			ConfigurationManager  cm2 = (ConfigurationManager)ConfigurationSettings.GetConfig("Framework");
			string eventServerUrl = cm2.EventNotificationConfig.GetEventServerUrl();

		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?