Example #1
0
 public static DBAccessor Instance()
 {
     if (_instance == null)
     {
         _instance = new DBAccessor();
     }
     _instance.ConnectionDatabase();
     return(_instance);
 }
Example #2
0
        /// <summary>
        /// 取得一个数据库访问器实例
        /// </summary>
        public static DBAccessor Instance(DBConnection dbc)
        {
            DBAccessor dba = new DBAccessor(dbc)
            {
                AccessorKey = string.Format("{0}_{1}", dbc.ConnName, Guid.NewGuid().ToString())
            };

            _cachedAccessor[dba.AccessorKey] = dba;
            dba.ConnectionDatabase();
            return(dba);
        }