order.cs

来自「ASP.net网站开发四“酷”全书:新闻、论坛、电子商城、博客_源码」· CS 代码 · 共 25 行

CS
25
字号
using System;
using System.EnterpriseServices;
using System.Reflection;
using System.Configuration;

namespace BookShop.DALFactory {
	
	/// <summary>
	/// Factory implementaion for the Order DAL object
	/// </summary>
	public class Order {

		//public static BookShop.IDAL.IOrder GetOrder() {
		public static BookShop.IDAL.IOrder Create() {

			/// Look up the DAL implementation we should be using
			string path = System.Configuration.ConfigurationSettings.AppSettings["OrdersDAL"];
			string className = path + ".Order";

			// Using the evidence given in the config file load the appropriate assembly and class
			return (BookShop.IDAL.IOrder)Assembly.Load(path).CreateInstance(className);	
		}
	}
}

⌨️ 快捷键说明

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