Student/DAL/SqlDB.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//|5|1|a|s|p|x
using CC.Data.DAL;
namespace Student.DAL
{
    public class SqlDB<D, T> : DALBase<T>
        where T : class,new()
        where D : class
    {
        public SqlDB()
        {
            DALBase<T>.ConnectionString = "server=.\\SQL2008R2;database=Student;uid=sa;pwd=sa;max pool size=512;";
        }

        private static D _instance = default(D);
        private static object _lockHelper = new object();


        /// <summary>
        /// 单体模式返回类实例
        /// </summary>
        /// <returns></returns>
        public static D GetInstance()
        {
            if (_instance == null)
            {
                lock (_lockHelper)
                {
                    if (_instance == null)
                    {
                        _instance = Activator.CreateInstance<D>();
                    }
                }
            }
            return _instance;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。