diff --git a/02ConnectionString/02ConnectionString.csproj b/02ConnectionString/02ConnectionString.csproj index 80d21c2..f279c26 100644 --- a/02ConnectionString/02ConnectionString.csproj +++ b/02ConnectionString/02ConnectionString.csproj @@ -20,6 +20,8 @@ + + diff --git a/02ConnectionString/Program.cs b/02ConnectionString/Program.cs index 9b63718..ae3a501 100644 --- a/02ConnectionString/Program.cs +++ b/02ConnectionString/Program.cs @@ -1,10 +1,17 @@ -namespace _02ConnectionString +using Microsoft.Extensions.Configuration; + +namespace _02ConnectionString { internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + var configuration = new ConfigurationBuilder() + .AddJsonFile("appsettings.json") + .Build(); + + Console.WriteLine(configuration.GetSection("constr").Value); + Console.ReadKey(); } } } \ No newline at end of file diff --git a/02ConnectionString/appsettings.json b/02ConnectionString/appsettings.json index 1e8f5ae..ab8e4ba 100644 --- a/02ConnectionString/appsettings.json +++ b/02ConnectionString/appsettings.json @@ -1,3 +1,4 @@ { "constr": "Data Source=MSI;Initial Catalog=DigitalCurrency;Integrated Security=True;Connect Timeout=30;Encrypt=False;Trust Server Certificate=False;Application Intent=ReadWrite;Multi Subnet Failover=False" } + \ No newline at end of file