{"id":960,"date":"2017-02-21T15:40:24","date_gmt":"2017-02-21T06:40:24","guid":{"rendered":"http:\/\/okamurax.com\/?p=960"},"modified":"2020-10-21T04:22:11","modified_gmt":"2020-10-20T19:22:11","slug":"%e3%82%af%e3%83%a9%e3%82%b9%e8%a8%ad%e8%a8%88%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=960","title":{"rendered":"C# \u8a2d\u8a08\u30e1\u30e2"},"content":{"rendered":"<p>\u9806\u4e0d\u540c\u3002\u601d\u3044\u3064\u305f\u3089\u66f4\u65b0\u3002<\/p>\n<p>\u30fb\u30af\u30e9\u30b9\u306e\u5358\u4f4d<\/p>\n<p>GUI\u306e\u30d5\u30a9\u30fc\u30e0\u5358\u4f4d\u306e\u30af\u30e9\u30b9\u304c\u57fa\u672c(GUI\u304c\u306a\u3051\u308c\u3070\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u7ba1\u7406)\u3067\u3001\u305d\u306e\u4e2d\u3067\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<\/p>\n<p>\uff11\uff0e\u5909\u66f4\u306e\u767a\u751f\u3057\u305d\u3046\u306a\u90e8\u5206\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<br \/>\n\u62e1\u5f35\u30dd\u30a4\u30f3\u30c8(DI)<\/p>\n<p>\uff12\uff0e\u5171\u901a\u3067\u4f7f\u3046\u90e8\u5206\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<br \/>\n\u30a2\u30c0\u30d7\u30bf\u30fc(\u5408\u6210\uff0b\u59d4\u8b72)\u3067\u5171\u901a\u5316<br \/>\n\u30b9\u30c8\u30e9\u30c6\u30b8\u30fc<\/p>\n<p>\uff13\uff0e\u4ed6\u30af\u30e9\u30b9\u304b\u3089\u53c2\u7167\u3055\u308c\u308b\u90e8\u5206\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<\/p>\n<p>\uff14\uff0e\u30c6\u30b9\u30c8\u3057\u305f\u3044\u90e8\u5206\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<\/p>\n<p>\uff15\uff0e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002<br \/>\n\u751f\u6210\u51e6\u7406\u30921\u7b87\u6240\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u3067\u5909\u66f4\u306b\u5bfe\u5fdc\u3057\u3084\u3059\u304f\u3002<br \/>\nDI\u304c\u9023\u7d9a\u3057\u3066\u4e0a\u4f4d\u30ec\u30a4\u30e4\u30fc\u306b\u5f15\u6570\u304c\u6ea2\u308c\u3066\u304d\u305f\u3089\u3002<br \/>\n(\u4f5c\u308b\u3068\u4f7f\u3046\u3092\u5206\u3051\u308b)<\/p>\n<p>\uff16\uff0e\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u306a\u5024\u306b\u578b\u5b9a\u7fa9\u3059\u308b\u5834\u5408\u3002<br \/>\n\u5024\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/p>\n<p>\u30fb\u30af\u30e9\u30b9\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3001\u30e1\u30bd\u30c3\u30c9<\/p>\n<p>\u53c2\u7167\u3068\u5909\u66f4\u3092\u5206\u3051\u308b(CQS)\u3002\u610f\u5473\u306e\u3042\u308b\u540d\u524d\u306b\u3059\u308b\u3002\u30b9\u30b3\u30fc\u30d7\u304c\u5927\u304d\u3044\u306e\u306b\u4e00\u6587\u5b57\u5909\u6570\u540d\u3084\u3001\u30cf\u30fc\u30c9\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u3044\u308b\u6570\u5024\u306a\u3069\u907f\u3051\u308b\u3002\u3068\u308a\u3042\u3048\u305a\u30e1\u30bd\u30c3\u30c9\u306f\u5c0f\u3055\u304f\u3002<\/p>\n<p>\u30fb\u30ec\u30a4\u30e4\u30fc<\/p>\n<p>\u9069\u5207\u306b\u30af\u30e9\u30b9\u5206\u3051\u3057\u3066\u3044\u3051\u3070\u6700\u7d42\u7684\u306b\u81ea\u7136\u3068\u30ec\u30a4\u30e4\u30fc\u306b\u5f53\u3066\u306f\u307e\u308b\u5f62\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u305d\u308c\u307b\u3069\u610f\u8b58\u3057\u306a\u3044\u3002<\/p>\n<p>\u30fb\u4f9d\u5b58\u95a2\u4fc2\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb<\/p>\n<p>\u30af\u30e9\u30b9\u9593\u306e\u4f9d\u5b58\u3092\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3078\u306e\u4f9d\u5b58\u306b\u3059\u308b\u3053\u3068\u3002\u6d3e\u751f\u30af\u30e9\u30b9\u306e\u8ffd\u52a0\u3067\u5bfe\u5fdc\u3059\u308b\u3002\u62e1\u5f35\u30dd\u30a4\u30f3\u30c8\u3068\u547c\u3076\u5834\u5408\u3082\u3042\u308b\u3002<\/p>\n<pre class=\"lang:c# decode:true \">    public partial class Form1 : Form\r\n    {\r\n        public Form1()\r\n        {\r\n            InitializeComponent();\r\n\r\n            \/\/ \u4e0b\u4f4d\u30ec\u30a4\u30e4\u30fc\u306b\u4f9d\u5b58\u3059\u308b\u3068\u4e0b\u4f4d\u30ec\u30a4\u30e4\u30fc\u306e\u5909\u66f4\u306b\u5f71\u97ff\u3092\u53d7\u3051\u308b\r\n\r\n            new App(\"\");\r\n            \/\/ App\u3067SayHello\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3092\u3057\u3066\u3044\u308b \r\n\r\n            new App();\r\n            \/\/ SayHello\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092Builder\u3067\u751f\u6210\u3057\u3001App\u5185\u3067\u5229\u7528\u3057\u3066\u3044\u308b\r\n            \/\/ (\u751f\u6210\u3068\u5229\u7528\u306e\u5206\u96e2)\r\n\r\n            new App(new Builder());\r\n            \/\/ Builder\u306e\u751f\u6210\u3092App\u306e\u751f\u6210\u3068\u540c\u3058\u30ec\u30a4\u30e4\u30fc\u5316\r\n            \/\/ App\u306fBuilder\u306b\u4f9d\u5b58(\u5229\u7528)\u3057\u3066\u3044\u305f\u304c\u3001\r\n            \/\/ App\u3001Builder\u3068\u3082\u306bIFactory\u306b\u4f9d\u5b58\u3059\u308b\u3053\u3068\u306b\u306a\u308b\r\n            \/\/ (DI)\r\n        }\r\n    }\r\n    \r\n    class App\r\n    {\r\n        public App(string dummy)\r\n        {\r\n            new SayHello().Do();\r\n        }\r\n\r\n        public App()\r\n        {\r\n            new Builder().CreateObj().Do();\r\n        }\r\n\r\n        public App(IFactory f)\r\n        {\r\n            f.CreateObj().Do();\r\n        }\r\n\r\n    }\r\n\r\n    class Builder : IFactory\r\n    {\r\n        public SayHello CreateObj()\r\n        {\r\n            return new SayHello();\r\n        }\r\n    }\r\n\r\n    interface IFactory\r\n    {\r\n        SayHello CreateObj();\r\n    }\r\n\r\n    class SayHello\r\n    {\r\n        public void Do()\r\n        {\r\n            MessageBox.Show(\"hello\");\r\n        }\r\n\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30fbDB\u7cfb<\/p>\n<p>DB\u306e\u4f9d\u5b58\u95a2\u4fc2\u3002FK\u304c\u3042\u308b\u65b9\u304c\u4f9d\u5b58\u3057\u3066\u3044\u308b\u3002\u4f9d\u5b58\u3057\u3066\u3044\u308b\u65b9\u304c\u5b50\u3002PK\u306f\u91cd\u8907\u3067\u304d\u306a\u3044\u3051\u3069\u3001FK\u306f\u91cd\u8907\u3067\u304d\u308b\u306e\u3067\u3001FK\u3042\u308b\u65b9\u304c\u591a\u3002<\/p>\n<p>\u8907\u5408\u4e3b\u30ad\u30fc\u3068\u306a\u3063\u3066\u3044\u308b\u95a2\u4fc2\u5f93\u5c5e\u3092\u53d6\u308a\u9664\u304f\u6b63\u898f\u5316\u306f\u5f53\u305f\u308a\u524d\u306b\u767a\u751f\u3059\u308b\u306e\u3067\u3001\u6b63\u3057\u3044\u30e2\u30c7\u30ea\u30f3\u30b0\u3092\u3059\u308b\u3068\u5fc5\u7136\u7684\u306b\u8907\u5408\u4e3b\u30ad\u30fc\u304c\u73fe\u308c\u308b\u3002\u30b5\u30ed\u30b2\u30fc\u30c8\u30ad\u30fc\u3092\u5165\u308c\u308b\u5834\u5408\u3001\u5236\u7d04\u306f\u30a2\u30d7\u30ea\u5074\u3067\u5bfe\u5fdc\u3059\u308b\u3002\u4f8b\u3048\u3070\u4ed5\u5165\u4fa1\u683c\u3092\u3001\u4ed5\u5165\u5148\u30fb\u5546\u54c1\u30fb\u958b\u59cb\u5e74\u6708\u3067\u8b58\u5225\u3059\u308b\u3088\u3046\u306a\u5834\u5408\u3002<\/p>\n<p>\u53c2\u7167\u6574\u5408\u6027\u3002\u5b9f\u52d9\u3067\u306f\u5b8c\u5168\u306a\u5236\u7d04\u304c\u5fc5\u8981\u3067\u306f\u306a\u304f\u3001\u7de9\u3044\u5236\u7d04\u306e\u65b9\u304c\u90fd\u5408\u304c\u3044\u3044\u3068\u304d\u3082\u3042\u308b\u3002\u305f\u3060\u3057\u3001\u69cb\u9020\u304c\u58ca\u308c\u3084\u3059\u304f\u306f\u306a\u308b\u306e\u3067\u6ce8\u610f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9806\u4e0d\u540c\u3002\u601d\u3044\u3064\u305f\u3089\u66f4\u65b0\u3002 \u30fb\u30af\u30e9\u30b9\u306e\u5358\u4f4d GUI\u306e\u30d5\u30a9\u30fc\u30e0\u5358\u4f4d\u306e\u30af\u30e9\u30b9\u304c\u57fa\u672c(GUI\u304c\u306a\u3051\u308c\u3070\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u7ba1\u7406)\u3067\u3001\u305d\u306e\u4e2d\u3067\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002 \uff11\uff0e\u5909\u66f4\u306e\u767a\u751f\u3057\u305d\u3046\u306a\u90e8\u5206\u3092\u30af\u30e9\u30b9\u306b\u629c\u304d\u51fa\u3059\u3002 \u62e1\u5f35\u30dd\u30a4\u30f3\u30c8(D &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=960\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;C# \u8a2d\u8a08\u30e1\u30e2&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9,144],"class_list":["post-960","post","type-post","status-publish","format-standard","hentry","category-1","tag-c-net","tag-144"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=960"}],"version-history":[{"count":116,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/960\/revisions"}],"predecessor-version":[{"id":3816,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/960\/revisions\/3816"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}