Exemple #1
0
 public static AccessUtil SingleSqlDBUtil()
 {
     if (accessUtil == null)
     {
         accessUtil = new AccessUtil();
         return(accessUtil);
     }
     else
     {
         return(accessUtil);
     }
 }
        /// <summary>
        /// 构造函数注入。单例模式。
        /// </summary>
        /// <param name="dbType"></param>
        private DBFactory(DBType dbType)
        {
            switch (dbType)
            {
            case DBType.sql:
                dBUtil = SqlDBUtil.SingleSqlDBUtil();
                break;

            case DBType.access:
                dBUtil = AccessUtil.SingleSqlDBUtil();
                break;

            default:
                dBUtil = SqlDBUtil.SingleSqlDBUtil();
                break;
            }
        }