using System.Configuration;
using System.Reflection;

namespace Stat.DALFactory
{
    /// <summary>
    /// 抽象工厂
    /// </summary>
    public abstract class AbstractFactory
    {
        ///抽象
        public abstract IDAL.IAD CreateAD();
        public abstract IDAL.ICompany CreateCompany();
        public abstract IDAL.IFriendLink CreateFriendLink();
        public abstract IDAL.IMessage CreateMessage();
        public abstract IDAL.INavigate CreateNavigate();
        public abstract IDAL.INews CreateNews();
        public abstract IDAL.INotify CreateNotify();
        public abstract IDAL.IStatTask CreateStat();
        public abstract IDAL.IStmp CreateStmp();
        public abstract IDAL.ISystems CreateSystems();
        public abstract IDAL.IUsers CreateUsers();
        public abstract IDAL.IViewDay CreateViewDay();
        public abstract IDAL.IViewEngine CreateViewEngine();
        public abstract IDAL.IViewEnginePageIndex CreateViewEnginePageIndex();
        public abstract IDAL.IViewHour CreateViewHour();
        public abstract IDAL.IViewClick CreateViewOnClick();
        public abstract IDAL.IViewOnClickPageIndex CreateViewOnClickPageIndex();
        public abstract IDAL.IWebsitePageIndex CreateWebsitePageIndex();
        public abstract IDAL.IWebSites CreateWebSites();
        public abstract IDAL.IIP CreateIP();
        public abstract IDAL.IDatabase CreateDatabase();
        public abstract IDAL.ILog CreateLog();
        public abstract IDAL.IWebsiteStructure CreateWebsiteStructure();
        public abstract IDAL.IViewBrowser CreateViewBrowser();
        public abstract IDAL.IViewSystem CreateViewSystem();
        public abstract IDAL.IViewResolve CreateViewResolve();
        public abstract IDAL.IViewLanguage CreateViewLanguage();
        public abstract IDAL.IViewColorDepth CreateViewColorDepth();
        public abstract IDAL.IViewReturnuser CreateViewReturnuser();
        public abstract IDAL.IViewClrVersion CreateViewClrVersion();
        public abstract IDAL.IViewColumn CreateViewColumn();
        public abstract IDAL.IViewContent CreateViewContent();
        public abstract IDAL.IViewAlexa CreateViewAlexa();
        public abstract IDAL.IViewJavaApplet CreateViewJavaApplet();
        public abstract IDAL.IViewUrlPage CreateViewUrlPage();
        public abstract IDAL.IViewDomain CreateViewDomain();
        public abstract IDAL.IViewUrlFrom CreateViewUrlFrom();
        public abstract IDAL.IViewRclass CreateViewRclass();
        public abstract IDAL.IViewTop CreateViewTop();
        public abstract IDAL.IViewIP CreateViewIP();
        public abstract IDAL.ICommon CreateCommon();
        public abstract IDAL.IViewTele CreateTele();
        public abstract IDAL.IViewProvince CreateProvince();
        public abstract IDAL.IViewEnter CreateEnter();
        public abstract IDAL.IViewExit CreateExit();
        public abstract IDAL.IViewOnLine CreateOnLine();
        public abstract IDAL.IGatherServer CreateGatherServer();

        /// <summary>
        /// 程序集反射创建实例
        /// </summary>
        /// <returns></returns>
        public static AbstractFactory GetInstance()
        {
            string factoryName = ConfigurationManager.AppSettings["DALFactory"];
            if (!string.IsNullOrEmpty(factoryName))
            {
                string className = factoryName + ".DALFactory";

                return (AbstractFactory)Assembly.Load(factoryName).CreateInstance(className);

            }
            return null;
        }
    }
}
