{"id":738,"date":"2023-06-16T19:17:06","date_gmt":"2023-06-16T10:17:06","guid":{"rendered":"https:\/\/mvc.auctionpro.co.kr\/?page_id=738"},"modified":"2023-06-16T19:17:17","modified_gmt":"2023-06-16T10:17:17","slug":"appsettings-json-%ec%84%b8%ed%8c%85%ea%b0%92-%ec%82%ac%ec%9a%a9%ed%95%98%ea%b8%b0","status":"publish","type":"page","link":"https:\/\/mvc.auctionpro.co.kr\/?page_id=738","title":{"rendered":"appsettings.json \uc138\ud305\uac12 \uc0ac\uc6a9\ud558\uae30"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Overview :  win.config \uc640 \uac19\uc740 \uae30\ub2a5<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">1.appsettings.json<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \" title=\"JSON\">{\n  \"Position\": {\n    \"Title\": \"Editor\",\n    \"Name\": \"Joe Smith\"\n  },\n  \"MyKey\": \"My appsettings.json Value\",\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Information\",\n      \"Microsoft\": \"Warning\",\n      \"Microsoft.Hosting.Lifetime\": \"Information\"\n    }\n  },\n  \"AllowedHosts\": \"*\"\n}<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">2. C#<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" title=\"C#\">public class TestModel : PageModel\n{\n    \/\/ requires using Microsoft.Extensions.Configuration;\n    private readonly IConfiguration Configuration;\n\n    public TestModel(IConfiguration configuration)\n    {\n        Configuration = configuration;\n    }\n\n    public ContentResult OnGet()\n    {\n        var myKeyValue = Configuration[\"MyKey\"];\n        var title = Configuration[\"Position:Title\"];\n        var name = Configuration[\"Position:Name\"];\n        var defaultLogLevel = Configuration[\"Logging:LogLevel:Default\"];\n\n\n        return Content($\"MyKey value: {myKeyValue} \\n\" +\n                       $\"Title: {title} \\n\" +\n                       $\"Name: {name} \\n\" +\n                       $\"Default Log Level: {defaultLogLevel}\");\n    }\n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview : win.config \uc640 \uac19\uc740 \uae30\ub2a5 1.appsettings.json 2. C#<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-738","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/738","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=738"}],"version-history":[{"count":1,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/738\/revisions"}],"predecessor-version":[{"id":740,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/738\/revisions\/740"}],"wp:attachment":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=738"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}