{"id":254,"date":"2017-07-25T23:59:58","date_gmt":"2017-07-25T14:59:58","guid":{"rendered":"http:\/\/reasty.net\/?p=254"},"modified":"2017-07-25T23:59:58","modified_gmt":"2017-07-25T14:59:58","slug":"25%ec%9e%a5-asp-net-core-1-0-mvc-%ed%94%84%eb%a0%88%ec%9e%84%ec%9b%8c%ed%81%ac","status":"publish","type":"post","link":"https:\/\/reasty.net\/?p=254","title":{"rendered":"25\uc7a5 ASP.NET Core 1.0 MVC \ud504\ub808\uc784\uc6cc\ud06c"},"content":{"rendered":"<h1>25.1. ASP.NET Core MVC<\/h1>\n<p>ASP.NET Core \uc6f9 \uc751\uc6a9 \ud504\ub85c\uadf8\ub7a8 \ud15c\ud50c\ub9bf\uc73c\ub85c \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud558\uba74 MVC\ub97c \uc0ac\uc6a9\ud558\ub294\ub370 \ud544\uc694\ud55c \ubaa8\ub4e0 \uad6c\uc131\uc694\uc18c\uac00 \uac16\ucd94\uc5b4\uc838\uc788\ub2e4.<br \/>\nEmpty \ud15c\ud50c\ub9bf\uc73c\ub85c \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud55c \uacbd\uc6b0, NuGet \uc744 \uc774\uc6a9\ud558\uc5ec Microsoft.AspNetCore.Mvc \ud328\ud0a4\uc9c0\ub97c \ucd94\uac00\ud558\uba74 \ub41c\ub2e4.<br \/>\n\uadf8 \uc774\ud6c4 Startup.cs\ud30c\uc77c\uc5d0 AddMvc()\uba54\uc11c\ub4dc\uc640 UseMvc() \uba54\uc11c\ub4dc\ub97c \ud638\ucd9c\ud558\uace0, UseMvc() \uba54\uc11c\ub4dc\uc5d0\uc11c \ub77c\uc6b0\ud305 \uacbd\ub85c\ub97c \uc124\uc815\ud558\uba74 \ubaa8\ub4e0 \uc900\ube44\uac00 \ub05d\ub09c\ub2e4.<\/p>\n<pre title=\"Startup.cs\" class=\"lang:c# decode:true \">app.UseMvc(routes =&gt;\n{\n    routes.mapRoute(\n        name: \"default\",\n        template: \"{controller=Home}\/{action=Index}\/{id?}\");\n});<\/pre>\n<h1>25.2. \ub77c\uc6b0\ud305<\/h1>\n<ul>\n<li>WebForm &#8211; \ub514\uc2a4\ud06c\uc0c1\uc758 \ud30c\uc77c<\/li>\n<li>MVC &#8211; \ucee8\ud2b8\ub864\ub7ec \uc561\uc158(Controller Action)<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center; background-color: #b5b5b5;\"><strong><span style=\"color: #000000;\">\uacbd\ub85c<\/span><\/strong><\/td>\n<td style=\"text-align: center; background-color: #b5b5b5;\"><strong><span style=\"color: #000000;\">\ucee8\ud2b8\ub864\ub7ec \ud074\ub798\uc2a4<\/span><\/strong><\/td>\n<td style=\"text-align: center; background-color: #b5b5b5;\"><strong><span style=\"color: #000000;\">\uc561\uc158(Action) \uba54\uc11c\ub4dc<\/span><\/strong><\/td>\n<td style=\"text-align: center; background-color: #b5b5b5;\"><strong><span style=\"color: #000000;\">id \ub9e4\uac1c\ubcc0\uc218<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td>http:\/\/asp.net\/Home<\/td>\n<td>Home<\/td>\n<td>Index<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>http:\/\/asp.net\/Home\/Index<\/td>\n<td>Home<\/td>\n<td>Index<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>http:\/\/asp.net\/Home\/About<\/td>\n<td>Home<\/td>\n<td>About<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>http:\/\/asp.net\/Note\/Details\/12345<\/td>\n<td>Note<\/td>\n<td>Details<\/td>\n<td>12345<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center;\"><span style=\"font-size: 8pt;\">[\uae30\ubcf8\uc801\uc778 URL \ub77c\uc6b0\ud305]<\/span><\/p>\n<h1>25.4. \uc2e4\uc2b5<\/h1>\n<p>@inject \uc9c0\uc2dc\ubb38\uc740 DataFinder \ud074\ub798\uc2a4\ub97c \uc9c1\uc811 \ucee8\ud2b8\ub864\ub7ec\uc5d0\uc11c \ud638\ucd9c\ud574\uc11c \ubdf0 \ud398\uc774\uc9c0\ub85c \uc804\ub2ec\ud558\ub294 \uac8c \uc544\ub2c8\ub77c<br \/>\n\ubdf0 \ud398\uc774\uc9c0\uc5d0 \uc9c1\uc811 \uc8fc\uc785\ud574\uc11c \uc0ac\uc6a9\ud560 \uc218 \uc788\uac8c \ud558\ub294 \uc758\uc874\uc131 \uc8fc\uc785 \ubc29\uc2dd\uc774\ub2e4.<br \/>\n\uc774 \ucf54\ub4dc\ub97c \uc0ac\uc6a9\ud558\ub824\uba74 DataFinder \ud074\ub798\uc2a4\ub97c Startup.cs \uc5d0\uc11c \uc11c\ube44\uc2a4 \ub4f1\ub85d\uc744 \ud574\uc8fc\uc5b4\uc57c \ud55c\ub2e4.<\/p>\n<ul>\n<li style=\"text-align: left;\">services.AddTransient&lt;DataFinder&gt;(); &#8211; Transient : \ud2b8\ub79c\uc158\ud2b8, \uc77c\uc2dc\uc801\uc778<\/li>\n<li style=\"text-align: left;\">services.AddInstance(); &lt;= \ubb54\uc9c0 \ubaa8\ub974\uaca0\uc74c.<\/li>\n<\/ul>\n<p>\ubaa8\ub378\uc5d0\uc11c \ubc1c\uc0dd\ub41c \ub370\uc774\ud130\ub97c \ucee8\ud2b8\ub864\ub7ec\uac00 \uac00\uc838\ub2e4\uac00 \ubdf0 \ud398\uc774\uc9c0\uc5d0\uc11c \ucd9c\ub825\ud558\ub294 \ud615\ud0dc\uac00 MVC.<br \/>\nViewComponent \ub77c\ub294 \uac83\ub3c4 \uc788\ub2e4.<\/p>\n<p>\uc758\uc874\uc131 \uc8fc\uc785 \uae30\ub2a5\uacfc \ubdf0 \ucef4\ud3ec\ub10c\ud2b8.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>25.1. ASP.NET Core MVC ASP.NET Core \uc6f9 \uc751\uc6a9 \ud504\ub85c\uadf8\ub7a8 \ud15c\ud50c\ub9bf\uc73c\ub85c \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud558\uba74 MVC\ub97c \uc0ac\uc6a9\ud558\ub294\ub370 \ud544\uc694\ud55c \ubaa8\ub4e0 \uad6c\uc131\uc694\uc18c\uac00 \uac16\ucd94\uc5b4\uc838\uc788\ub2e4. Empty \ud15c\ud50c\ub9bf\uc73c\ub85c \ud504\ub85c\uc81d\ud2b8\ub97c \uc0dd\uc131\ud55c \uacbd\uc6b0, NuGet \uc744 \uc774\uc6a9\ud558\uc5ec Microsoft.AspNetCore.Mvc \ud328\ud0a4\uc9c0\ub97c \ucd94\uac00\ud558\uba74 \ub41c\ub2e4. \uadf8 \uc774\ud6c4 Startup.cs\ud30c\uc77c\uc5d0 AddMvc()\uba54\uc11c\ub4dc\uc640 UseMvc() \uba54\uc11c\ub4dc\ub97c \ud638\ucd9c\ud558\uace0, UseMvc() \uba54\uc11c\ub4dc\uc5d0\uc11c \ub77c\uc6b0\ud305 \uacbd\ub85c\ub97c \uc124\uc815\ud558\uba74 \ubaa8\ub4e0 \uc900\ube44\uac00 \ub05d\ub09c\ub2e4. app.UseMvc(routes =&gt; { routes.mapRoute( name: &#8220;default&#8221;, template: &#8220;{controller=Home}\/{action=Index}\/{id?}&#8221;); }); 25.2. \ub77c\uc6b0\ud305 WebForm &#8211; \ub514\uc2a4\ud06c\uc0c1\uc758 \ud30c\uc77c&#8230; <a href=\"https:\/\/reasty.net\/?p=254\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13,14],"tags":[18,19,21],"class_list":["post-254","post","type-post","status-publish","format-standard","hentry","category-asp-net-core","category-asp-net-core-net","tag-asp-net-core","tag-asp-net-korea-study-group","tag-c"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/posts\/254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254"}],"version-history":[{"count":0,"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/posts\/254\/revisions"}],"wp:attachment":[{"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}