mirror of
https://github.com/FalconWu2017/Falcon.StoredProcedureRunner.git
synced 2024-11-23 05:29:37 +08:00
使用用户机密管理数据库链接字符串
This commit is contained in:
parent
9767fdff20
commit
f03604fa0d
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"db": {
|
||||
"ver": "11",
|
||||
"oracle": "DATA SOURCE=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =47.103.62.60)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = orcl)));PASSWORD = harmonyhis;PERSIST SECURITY INFO = True;USER ID = HARMONYHIS;Connection Lifetime = 120;Connection Timeout = 60",
|
||||
"sqlserver": "Server=.\\SQLSERVER2008R2;Database=test;User ID=sa;Password=111;"
|
||||
"db": { //存储在客户端机密中
|
||||
"ver": "",
|
||||
"oracle": "",
|
||||
"sqlserver": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
<UserSecretsId>44468cb2-b159-42bd-a799-b3f004be5f68</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Falcon.StoredProcedureRunner.Tests
|
|||
System.Console.WriteLine("SqlserverTest start!");
|
||||
var configurationBuilder = new ConfigurationBuilder();
|
||||
configurationBuilder.AddJsonFile("AppSettings.json");
|
||||
configurationBuilder.AddUserSecrets(this.GetType().Assembly);
|
||||
var config = configurationBuilder.Build();
|
||||
var sql = config.GetSection("db:sqlserver").Value;
|
||||
var buider = new DbContextOptionsBuilder();
|
||||
|
@ -47,6 +48,7 @@ namespace Falcon.StoredProcedureRunner.Tests
|
|||
System.Console.WriteLine("OracleTest start!");
|
||||
var configurationBuilder = new ConfigurationBuilder();
|
||||
configurationBuilder.AddJsonFile("AppSettings.json");
|
||||
configurationBuilder.AddUserSecrets(this.GetType().Assembly);
|
||||
var config = configurationBuilder.Build();
|
||||
var ora = config.GetSection("db:oracle").Value;
|
||||
var oraVer = config.GetSection("db:ver").Value;
|
||||
|
|
Loading…
Reference in New Issue
Block a user