Exemplo n.º 1
0
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        /// <returns></returns>
        public static string ConnectionString()
        {
            Victory.Core.Helpers.ConfigHelper configHelper = new Victory.Core.Helpers.ConfigHelper("appsettings.json");

            var dbmodel = configHelper.Get <Model.DbModel>("ConnectionStrings");


            string connString = dbmodel.DevelopDatabase;

            if (dbmodel.DB == "ProductDatabase")
            {
                connString = dbmodel.ProductDatabase;
            }

            if (dbmodel.DB == "EnvironDatabase")
            {
                connString = dbmodel.EnvironDatabase;
            }

            if (dbmodel.DB == "DevelopDatabase")
            {
                connString = dbmodel.DevelopDatabase;
            }


            if (dbmodel.IsEncrypt)
            {
                connString = Victory.Core.Encrypt.Aes.AesDecrypt(connString, Core.Helpers.MachineHelper.GetCpuId());
            }

            return(connString);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 数据库连接字符串
        /// </summary>
        /// <returns></returns>
        public static string ConnectionString()
        {
            Victory.Core.Helpers.ConfigHelper configHelper = new Victory.Core.Helpers.ConfigHelper("appsettings.json");

            var dbmodel = configHelper.Get <Model.DbModel>("ConnectionStrings");

            if (dbmodel.DB == "ProductDatabase")
            {
                return(dbmodel.ProductDatabase);
            }

            if (dbmodel.DB == "EnvironDatabase")
            {
                return(dbmodel.EnvironDatabase);
            }

            if (dbmodel.DB == "DevelopDatabase")
            {
                return(dbmodel.DevelopDatabase);
            }

            return(dbmodel.DevelopDatabase);
        }