コード例 #1
0
        public static ConfigIntanceBase CreateDbInance()
        {
            string commonConfigString = (DataAccessSetting.CommonConfigurationListFile == null) ? string.Empty : DataAccessSetting.CommonConfigurationListFile.Trim();
            ConfigIntanceBase dbIntance = null;

            if (commonConfigString.Length > 0)
                dbIntance = new CommonDataInstance();
            else
                dbIntance = new NormalDataInstance();

            return dbIntance;
        }
コード例 #2
0
        /// <summary>
        /// ָ�������ַ����������õ������ַ���
        /// </summary>
        /// <param name="alisaName"></param>
        /// <returns></returns>
        public static string GetConnectionString(string alisaName)
        {
            string result = string.Empty;
            string commonConfigString = (DataAccessSetting.CommonConfigurationListFile == null) ? string.Empty : DataAccessSetting.CommonConfigurationListFile.Trim();
            ConfigIntanceBase dbIntance = null;

            if (commonConfigString.Length > 0)
                dbIntance = new CommonDataInstance();
            else
                dbIntance = new NormalDataInstance();
            IList<DatabaseInstance> dbList = dbIntance.GetIntanceList();
            foreach (DatabaseInstance item in dbList)
            {
                if (item.Name.Trim() == alisaName.Trim())
                {
                    result = item.ConnectionString;
                }
            }
            return result;
        }