{"id":263,"date":"2017-08-08T23:50:36","date_gmt":"2017-08-08T14:50:36","guid":{"rendered":"http:\/\/reasty.net\/?p=263"},"modified":"2017-08-08T23:50:36","modified_gmt":"2017-08-08T14:50:36","slug":"26%ec%9e%a5-%eb%aa%a8%eb%8d%b8-%eb%b7%b0-%ec%bb%a8%ed%8a%b8%eb%a1%a4%eb%9f%ac","status":"publish","type":"post","link":"https:\/\/reasty.net\/?p=263","title":{"rendered":"26\uc7a5 \ubaa8\ub378, \ubdf0, \ucee8\ud2b8\ub864\ub7ec"},"content":{"rendered":"<h1>26.1. MVC \ud328\ud134<\/h1>\n<ul>\n<li>Controller \u00a0: \ub85c\uc9c1\ucc98\ub9ac<\/li>\n<li>View \u00a0\u00a0: \uc0ac\uc6a9\uc790 \uc778\ud130\ud398\uc774\uc2a4<\/li>\n<li>Model \u00a0\u00a0: \ub370\uc774\ud130<\/li>\n<\/ul>\n<h1>26.2. \ucee8\ud2b8\ub864\ub7ec \ud074\ub798\uc2a4<\/h1>\n<p>Action \uba54\uc11c\ub4dc\ub97c \uad6c\ud604\ud558\ub294 \ud074\ub798\uc2a4.<br \/>\n\uc694\uccad \ucc98\ub9ac, \uc0ac\uc6a9\uc790 \uc785\ub825 \ucc98\ub9ac, \ub85c\uc9c1\uc218\ud589<\/p>\n<h1>26.3. \uc561\uc158 \uba54\uc11c\ub4dc<\/h1>\n<p>\ucee8\ud2b8\ub864\ub7ec\uc5d0\uc11c \ubdf0\ub97c \ud638\ucd9c\ud558\uac70\ub098 \ub370\uc774\ud130\ub97c \uc804\ub2ec\ud558\ub294 \uba54\uc11c\ub4dc<br \/>\nViewData, ViewGag \uac1c\uccb4\ub97c View \ud398\uc774\uc9c0\uc5d0 \uc804\ub2ec\ud560 \uc218 \uc788\ub2e4.<\/p>\n<h1>26.4. \uc2e4\uc2b5<\/h1>\n<p>\ubcc4\uac70\uc5c6\uc74c<\/p>\n<h1>26.5. \uc561\uc158 \ubc18\ud658\uac12<\/h1>\n<p>\uc8fc\uc694 \uc561\uc158 \ubc18\ud658\uac12<\/p>\n<ul>\n<li>View()\u00a0\u00a0\u00a0&#8211;\u00a0\uc561\uc158 \uba54\uc11c\ub4dc\uc5d0 \ud574\ub2f9\ud558\ub294 \ubdf0 \ud398\uc774\uc9c0 \uc2e4\ud589. \uc561\uc158 \uba54\uc11c\ub4dc \uc774\ub984 = \ubdf0 \ud398\uc774\uc9c0 \uc774\ub984<\/li>\n<li>RedirectToAction(URL)\u00a0&#8211;\u00a0\ud2b9\uc815 \uc561\uc158 \uba54\uc11c\ub4dc \uc2e4\ud589(\uc774\ub3d9).<br \/>\n<em>RedirectToAction(&#8220;Index&#8221;, &#8220;Home&#8221;);<\/em><\/li>\n<li>Content(&#8220;\ubb38\uc790\uc5f4&#8221;)\u00a0&#8211;\u00a0\ud2b9\uc815 \ubb38\uc790\uc5f4 \ubc18\ud658<\/li>\n<li>ContentResult()\u00a0\u00a0&#8211;\u00a0HTML\uc744 \uc9c1\uc811 \ubc18\ud658<br \/>\n<em>return new ContentResult() { Content = html, ContentType = &#8220;text\/heml;charset=utf-8&#8221; };<\/em><\/li>\n<\/ul>\n<h1>26.6. \uc2e4\uc2b5<\/h1>\n<p>\ubcc4\uac70\uc5c6\uc74c<\/p>\n<h2>26.6.4. Redirect\ub85c \uc2dc\uc791\ud558\ub294 \uc561\uc158 \uba54\uc11c\ub4dc \ubc18\ud658\uac12<\/h2>\n<p>\uc561\uc158 \uba54\uc11c\ub4dc\ub97c \uc2e4\ud589\ud558\uace0 \ub098\uc11c \uc0c8\ub85c\uc6b4\u00a0 \uc561\uc158 \uba54\uc11c\ub4dc \ub610\ub294 URL\ub85c \uc774\ub3d9\ud558\uace0\uc790 \ud560 \ub54c\ub294 Redirect\ub85c \uc2dc\uc791\ud558\ub294 \uc561\uc158 \ubc18\ud658\uac12\uc744 \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n<h1>26.7. \ubdf0\ud398\uc774\uc9c0<\/h1>\n<h2>26.7.1. \ucee8\ud2b8\ub864\ub7ec\uc640 \ubdf0\uc5d0 \ub300\ud55c \uaddc\uce59<\/h2>\n<p>\uac01\uac01\uc758 \ucee8\ud2b8\ub864\ub7ec\uc640 \uac19\uc740 \uc774\ub984\uc758 \uc11c\ube0c\ud3f4\ub354\ub97c \uc0dd\uc131\ud558\uace0, \uac01\uac01\uc758 \uc561\uc158 \uba54\uc11c\ub4dc\uc640 \uac19\uc740 \uc774\ub984\uc758 cshtml \ubdf0\ud398\uc774\uc9c0\ub97c \uc0dd\uc131\ud574\uc57c \ud55c\ub2e4.<br \/>\n\uacf5\ud1b5 \ud398\uc774\uc9c0\ub294 Shared \ud3f4\ub354\uc5d0 \uc704\uce58\ud55c\ub2e4.<\/p>\n<h1>26.8. \ub808\uc774\uc800 \ud45c\ud604\uc2dd<\/h1>\n<h2>26.8.2. \ub9c1\ud06c \uacbd\ub85c \ud574\uacb0:<\/h2>\n<pre class=\"lang:c# decode:true \">~\/<\/pre>\n<h1>26.9. \uc2e4\uc2b5<\/h1>\n<p>\ubcc4\uac70\uc5c6\uc74c<\/p>\n<h1>26.10. MVC \ud504\ub808\uc784\uc6cc\ud06c\uc5d0\uc11c\uc758 \ub808\uc774\uc544\uc6c3<\/h1>\n<p>\ub808\uc774\uc544\uc6c3\uc740 Views\/Shared \ud3f4\ub354\uc5d0 _Layout.cshtml \ud30c\uc77c\ub85c \uc874\uc7ac<\/p>\n<h2>26.10.1. _Layout.cshtml<\/h2>\n<p>\uac01 \ud398\uc774\uc9c0\uc758 \uc81c\ubaa9\uc740 \uac01\uac01\uc758 \ud398\uc774\uc9c0\uc758 ViewBag.Title \uc18d\uc131\uc744 \uc0ac\uc6a9\ud55c\ub2e4.<br \/>\nLayout \ud504\ub85c\ud37c\ud2f0\ub97c \ud1b5\ud558\uc5ec \uac01\uac01\uc758 \ud398\uc774\uc9c0\uc758 \ub808\uc774\uc544\uc6c3\uc744 \uc9c0\uc815\ud560 \uc218 \uc788\ub2e4.<\/p>\n<pre class=\"lang:c# decode:true \">@{ Layout = \"_Layout\"; }<\/pre>\n<h2>26.10.2. &lt;enviroment \/&gt; \ud0dc\uadf8 \ud5ec\ud37c<\/h2>\n<p>\ud2b9\uc815 CSS \ub610\ub294 JS \ud30c\uc77c\uc5d0 \ub300\ud55c \ub9c1\ud06c\ub97c Dev, Staging, Prod \ud658\uacbd\uc758 \uc138\uac00\uc9c0 \uc0c1\ud0dc\uc5d0 \ub9de\uac8c \uc801\uc6a9\ud558\uace0\uc790 \ud560 \ub54c \uc0ac\uc6a9\ud55c\ub2e4.<\/p>\n<h2>26.10.3. RenderBody() \uba54\uc11c\ub4dc\uc640 RenderSection(name, required) \uba54\uc11c\ub4dc<\/h2>\n<ul>\n<li>RenderBody() : \uac01\uac01\uc758 \ubdf0 \ub0b4\uc6a9\uc774 \ud45c\uc2dc\ub428<\/li>\n<li>RenderSection(name, required) : Scripts, Banners, Sidebars \ub4f1 \ud2b9\uc815\ud55c \uc139\uc158\uc744 \ucd94\uac00\ud560 \uc218 \uc788\ub2e4.<\/li>\n<\/ul>\n<h2>26.10.4. _ViewStart.cshtml<\/h2>\n<p>\ubaa8\ub4e0 \ubdf0\uac00 \ub80c\ub354\ub9c1 \ub418\uae30\uc804\uc5d0 \uc81c\uc77c \uba3c\uc800 \ud638\ucd9c\ub418\ub294 \ud398\uc774\uc9c0<br \/>\n_ViewStart.cshtml \ud30c\uc77c\uc740 Views\ud3f4\ub354\uc5d0 \uc704\uce58<br \/>\n\uacf5\ud1b5 \ub808\uc774\uc544\uc6c3\uc740 \ubc18\ub4dc\uc2dc \uc774\uacf3\uc5d0 \uc815\uc758\ud55c\ub2e4.<\/p>\n<h2>26.10.5. _ViewImports.cshtml<\/h2>\n<p>\ub124\uc784\uc2a4\ud398\uc774\uc2a4 \uacf5\ud1b5\uc0ac\uc6a9\uc2dc \uc815\uc758<br \/>\n@addTagHelper &lt;- \uc774\uac74 \ubb50\uc9c0??<\/p>\n<h2>26.10.6. \ubd80\ubd84 \ubdf0<\/h2>\n<p><em>Partial view<\/em><br \/>\n\ud398\uc774\uc9c0\uc5d0 \ud45c\uc2dc\ud558\uace0\uc790 \ud560\ub54c\ub294 Html.Partial() \uba54\uc11c\ub4dc \uc0ac\uc6a9<br \/>\nHtml.PartialAsync() \ube44\ub3d9\uae30\ub85c \ud45c\uc2dc?<\/p>\n<h1>26.11. \ubaa8\ub378 \ud074\ub798\uc2a4<\/h1>\n<p>DTO (Data Transfer Object), Entity, Business Object, Domain Model, View Model, Presentation Model<\/p>\n<h2>26.11.1. \ubaa8\ub378 \uc791\uc131 \uc2dc \uc81c\uc57d \uc870\uac74 \uc124\uc815<\/h2>\n<p>\ubaa8\ub378 \uc791\uc131\uc2dc Attribute \ub97c \uc0ac\uc6a9\ud558\uc5ec \uc635\uc158\uc744 \uc904 \uc218 \uc788\ub2e4.<br \/>\nDataType, Display, Validation(Required, StringLength, RegularExpression, Compare, \ub4f1)<\/p>\n<h1>26.12. \ubdf0\uc5d0 \ub370\uc774\ud130 \uc804\uc1a1 \ubc29\ubc95<\/h1>\n<p>Model, ViewBag(ViewData), TempData<\/p>\n<h2>26.12.1. ViewBag\uacfc ViewData<\/h2>\n<p>\uc561\uc158\uba54\uc11c\ub4dc\ub97c \uc774\uc6a9\ud558\uc5ec \uac04\ub2e8\ud55c \uc815\ubcf4\ub97c View\uc5d0 \uc804\ub2ec\ud560\ub54c \uc0ac\uc6a9<\/p>\n<h2>26.12.2. \ubaa8\ub378 \uac1c\uccb4 \uc0ac\uc6a9<\/h2>\n<p>\ubaa8\ub378 \ub370\uc774\ud130\ub97c View\uc5d0 \uc804\ub2ec. \uac15\ub825\ud55c \ud615\uc2dd(Strongly Typed)\uc758 \ubdf0 \ud398\uc774\uc9c0\uac00 \ub41c\ub2e4.<\/p>\n<h2>26.12.3. TempData<\/h2>\n<p>\ub2e4\uc74c\ubc88 TempData\ub97c \uc694\uccad\ud558\uae30 \uc804\uae4c\uc9c0 \uc720\ud6a8\ud55c \uc784\uc2dc \uc800\uc7a5\uc18c<br \/>\n<strong>Session \uae30\ubc18\uc73c\ub85c \ub3d9\uc791<\/strong>\ud558\uba70, <em>Microsoft.AspNetCore.Session<\/em>\uacfc <em>Microsoft.Framework.Caching.Memory<\/em> \uc758 \ucc38\uc870\uac00 \ud544\uc694\ud558\ub2e4.<\/p>\n<h1>26.13. \uc2e4\uc2b5<\/h1>\n<p>View\uc5d0\uc11c <em><strong>@model<\/strong> <\/em>\ud0a4\uc6cc\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \uac15\ub825\ud55c \ud615\uc2dd\uc758 \ubdf0\ub97c \ub9cc\ub4e0\ub2e4.<\/p>\n<h1>26.14. \uc2e4\uc2b5<\/h1>\n<p>\uc561\uc158\uba54\uc11c\ub4dc\uc5d0\uc11c [HttpGet], [HttpPost] \uc5b4\ud2b8\ub9ac\ubdf0\ud2b8\ub97c \uc774\uc6a9\ud558\uc5ec Form \uad00\ub828 \uc2e4\uc2b5<\/p>\n<h1>26.15. \uc2e4\uc2b5<\/h1>\n<p>\ubcc4\uac70\uc5c6\uc74c. \uc804\uccb4 \uc2e4\uc2b5<\/p>\n<p>&nbsp;<\/p>\n<h1>&#8211; \ucc38\uace0\uc790\ub8cc<\/h1>\n<p>[embeddoc url=&#8221;http:\/\/192.168.10.240:8080\/wp-content\/uploads\/2017\/09\/26\uc7a5.Core-\ubaa8\ub378-\ubdf0-\ucee8\ud2b8\ub864\ub7ec.pdf&#8221; download=&#8221;all&#8221;] \u2013\u00a0ASP.NET Korea Study Group, \uc548\uc9c0\uc624<\/p>\n","protected":false},"excerpt":{"rendered":"<p>26.1. MVC \ud328\ud134 Controller \u00a0: \ub85c\uc9c1\ucc98\ub9ac View \u00a0\u00a0: \uc0ac\uc6a9\uc790 \uc778\ud130\ud398\uc774\uc2a4 Model \u00a0\u00a0: \ub370\uc774\ud130 26.2. \ucee8\ud2b8\ub864\ub7ec \ud074\ub798\uc2a4 Action \uba54\uc11c\ub4dc\ub97c \uad6c\ud604\ud558\ub294 \ud074\ub798\uc2a4. \uc694\uccad \ucc98\ub9ac, \uc0ac\uc6a9\uc790 \uc785\ub825 \ucc98\ub9ac, \ub85c\uc9c1\uc218\ud589 26.3. \uc561\uc158 \uba54\uc11c\ub4dc \ucee8\ud2b8\ub864\ub7ec\uc5d0\uc11c \ubdf0\ub97c \ud638\ucd9c\ud558\uac70\ub098 \ub370\uc774\ud130\ub97c \uc804\ub2ec\ud558\ub294 \uba54\uc11c\ub4dc ViewData, ViewGag \uac1c\uccb4\ub97c View \ud398\uc774\uc9c0\uc5d0 \uc804\ub2ec\ud560 \uc218 \uc788\ub2e4. 26.4. \uc2e4\uc2b5 \ubcc4\uac70\uc5c6\uc74c 26.5. \uc561\uc158 \ubc18\ud658\uac12 \uc8fc\uc694 \uc561\uc158 \ubc18\ud658\uac12 View()\u00a0\u00a0\u00a0&#8211;\u00a0\uc561\uc158 \uba54\uc11c\ub4dc\uc5d0 \ud574\ub2f9\ud558\ub294 \ubdf0 \ud398\uc774\uc9c0 \uc2e4\ud589. \uc561\uc158 \uba54\uc11c\ub4dc&#8230; <a href=\"https:\/\/reasty.net\/?p=263\">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-263","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\/263","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=263"}],"version-history":[{"count":0,"href":"https:\/\/reasty.net\/index.php?rest_route=\/wp\/v2\/posts\/263\/revisions"}],"wp:attachment":[{"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reasty.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}