可以设置本地调试环境配置
This commit is contained in:
		
							parent
							
								
									335b335f7b
								
							
						
					
					
						commit
						91b37a6dbf
					
				
							
								
								
									
										12
									
								
								ReportService/.config/dotnet-tools.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								ReportService/.config/dotnet-tools.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "version": 1,
 | 
			
		||||
  "isRoot": true,
 | 
			
		||||
  "tools": {
 | 
			
		||||
    "dotnet-ef": {
 | 
			
		||||
      "version": "3.1.5",
 | 
			
		||||
      "commands": [
 | 
			
		||||
        "dotnet-ef"
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -8,9 +8,10 @@
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "profiles": {
 | 
			
		||||
    "IIS Express": {
 | 
			
		||||
    "FalconIIS": {
 | 
			
		||||
      "commandName": "IISExpress",
 | 
			
		||||
      "environmentVariables": {
 | 
			
		||||
        "DbConnStr": "Server=.\\SQLSERVER2008R2;Database=ReportService;User ID=sa;Password=111",
 | 
			
		||||
        "ASPNETCORE_ENVIRONMENT": "Development"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,6 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Builder;
 | 
			
		||||
using Microsoft.AspNetCore.Hosting;
 | 
			
		||||
using Microsoft.AspNetCore.HttpsPolicy;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Microsoft.Extensions.Configuration;
 | 
			
		||||
using Microsoft.Extensions.DependencyInjection;
 | 
			
		||||
@ -24,8 +20,9 @@ namespace ReportService
 | 
			
		||||
        // This method gets called by the runtime. Use this method to add services to the container.
 | 
			
		||||
        public void ConfigureServices(IServiceCollection services) {
 | 
			
		||||
 | 
			
		||||
            var connStr = Environment.GetEnvironmentVariable("DbConnStr")
 | 
			
		||||
                ??this.Configuration.GetValue<string>("Database:ReportService");
 | 
			
		||||
            services.AddDbContext<RSDbContext>(b => {
 | 
			
		||||
                var connStr = this.Configuration.GetValue<string>("Database:ReportService");
 | 
			
		||||
                b.UseSqlServer(connStr);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user