示例#1
0
        public static AppDb_SMAEntities GetDBContext()
        {
            var dbContext = new AppDb_SMAEntities();

            if (SettingController.Get <int>("IsLive") == 1)
            {
                SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();
                // Set the properties for the data source.
                sqlBuilder.DataSource         = "APL-MZHANG-W8\\SQLEX2017";
                sqlBuilder.InitialCatalog     = "AppDb_SMA";
                sqlBuilder.IntegratedSecurity = false;
                sqlBuilder.UserID             = "sma";
                sqlBuilder.Password           = "******";

                dbContext.Database.Connection.ConnectionString = sqlBuilder.ConnectionString;
            }

            return(dbContext);
        }