Exemple #1
0
        public static SqlDBEXE GetInstance(string connString)
        {
            System.Threading.Monitor.Enter(lockObj);
            if (instance == null)
            {
                instance = new SqlDBEXE(connString);
            }
            System.Threading.Monitor.Exit(lockObj);

            return(instance);
        }
Exemple #2
0
        protected SqlServerDB()
        {
            AppSettingsReader settingReader = new AppSettingsReader();

            dbMasterConnectString = settingReader.GetValue("MYORMConnectionString", typeof(string)) as string;
            dbExe        = SqlDBEXE.GetInstance(dbMasterConnectString);
            DatabaseName = settingReader.GetValue("DatabaseName", typeof(string)) as string;

            DbFileDir = settingReader.GetValue("DatabaseDir", typeof(string)) as string;
            if (!DbFileDir.EndsWith("\\"))
            {
                DbFileDir += "\\";
            }
            if (!DBContians())
            {
                this.CreateDatebase();
            }
            dbExe.ConnectString = dbMasterConnectString.Replace("master", DatabaseName);
        }