这段程序谁能看的懂啊?

using System;
using System.Xml.Serialization;
using System.Configuration;

namespace Bzfc.Components
{
 /// <summary>
 /// Globals 的摘要说明。
 /// </summary>
 ///

 public class Globals
 {
  public Globals()
  {
   //
   // TODO: 在此处添加构造函数逻辑
   //
  }
  public static IDTOProvider DbProvider
  {
   get
   {
    return DTOProvider.Instance();
   }
  }

 }

 //返回DTOProviderConfiguration.Instance()
 public class DTOProvider
 {
  private DTOProvider(){}
  
  static DTOProvider()
  {
   DTOProviderConfiguration dtoPC = Config.Settings.WebProviders.DTOProvider;
   idto = (IDTOProvider)dtoPC.Instance();
  }
  private static IDTOProvider idto = null;
  public static IDTOProvider Instance()
  {
   return idto;
  }
 }

 

 public class DbProvider
 {
  private DbProvider()
  {
  }
  static DbProvider()
  {
   DbProviderConfiguration dpc = Config.Settings.WebProviders.DbProvider;
   dp = (IDbProvider)dpc.Instance();
  
  }
  private static IDbProvider dp = null;
  public static IDbProvider Instance()
  {
   return dp;
  }
 }


 public class DataDTOProvider : IDTOProvider
 {
  public bool AddUser()
  {
   return DbProvider.Instance().AddUser();
  }
 
 }

 

 

/// <summary>
///    Config.Setting = WebConfigurationSettings.Instance();
/// </summary>
 public class Config
 {
  
  public Config()
  {
  }
  public static WebConfigurationSettings Settings
  {
   get
   {
    return WebConfigurationSettings.Instance();
   }
  }
 }


 /// <summary>
 /// WebConfigurationSettings.Instance();
 /// </summary>
 [Serializable]
 public class WebConfigurationSettings
 {
  public WebConfigurationSettings()
  {
  }
  public static WebConfigurationSettings Instance()
  {
   return ((WebConfigurationSettings)ConfigurationSettings.GetConfig("WebConfigurationSettings"));
  }
  private WebProviders _webProviders;
  public WebProviders WebProviders
  {
   get {return this._webProviders;}
   set {this._webProviders = value;}
  }
 }
 [XmlRoot("DTOProvider")]
 public class DTOProviderConfiguration : BaseProvider
 {
  public DTOProviderConfiguration()
  {
   //
   // TODO: Add constructor logic here
   //
  }
 }

 

 public abstract class BaseProvider
 {
  public BaseProvider()
  {
   //
   // TODO: Add constructor logic here
   //
  }

  //public abstract object Instance();

  private string _type;

  [XmlAttribute("type")]
  public string ProviderType
  {
   get { return _type; }
   set { _type = value; }
  }

  public object Instance()
  {
   return Activator.CreateInstance(System.Type.GetType(this.ProviderType));
  }
 }

 /// <summary>
 /// DTOProvider
 /// </summary>
 public class WebProviders
 {
  public WebProviders()
  {

  }
  private DTOProviderConfiguration _dTOProvider;
  public DTOProviderConfiguration DTOProvider
  {
   get {return this._dTOProvider;}
   set {this._dTOProvider = value;}
  }
  private DbProviderConfiguration _dbProvider;
  public DbProviderConfiguration DbProvider
  {
   get {return this._dbProvider;}
   set {this._dbProvider = value;}
  }
 }

 

 [XmlRoot("DbProvider")]
 public class DbProviderConfiguration : BaseProvider
 {
  public DbProviderConfiguration()
  {
  }

  private string _connectionString;
  [XmlAttribute("connectionString")]
  public string ConnectionString
  {
   get {return this._connectionString;}
   set {this._connectionString = value;}
  }

 }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值