{"id":2760,"date":"2015-07-29T09:01:42","date_gmt":"2015-07-29T01:01:42","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=2760"},"modified":"2015-07-29T16:07:21","modified_gmt":"2015-07-29T08:07:21","slug":"qplugins-%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98%e7%ad%94%e9%97%ae","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=2760","title":{"rendered":"[QPlugins] \u5e38\u89c1\u95ee\u9898\u7b54\u95ee"},"content":{"rendered":"<h4>1\u3001QPlugins \u662f\u4ec0\u4e48\uff1f<\/h4>\n<p>QPlugins \u662f\u4e00\u4e2a\u63d2\u4ef6\u7ba1\u7406\u5f15\u64ce\uff0c\u5b83\u57fa\u4e8e Delphi \u7f16\u5199\uff0c\u652f\u6301\u5404\u79cd\u8bed\u8a00\u505a\u4e3a\u5bbf\u4e3b\u548c\u63d2\u4ef6\u3002\u867d\u7136\u662f\u4e00\u4e2a\u63d2\u4ef6\u5f15\u64ce\uff0c\u4f46 QPlugins \u66f4\u60f3\u5f3a\u8c03\u7684\u662f\u670d\u52a1\u7684\u6982\u5ff5\uff0c\u800c\u4e0d\u662f\u63d2\u4ef6\u3002\u63d2\u4ef6\u5728 QPlugins \u91cc\u53ea\u662f\u5404\u79cd\u670d\u52a1\u7684\u5bb9\u5668\uff0c\u5404\u79cd\u670d\u52a1\u624d\u662f QPlugins \u60f3\u8981\u6574\u5408\u7684\u4e3b\u4f53\u3002QPlugins \u7684\u8be6\u7ec6\u4ecb\u7ecd\u8bf7\u53c2\u8003 QPlugins \u4e13\u9898\u7684\u5176\u5b83\u8bf4\u660e\u3002<\/p>\n<h4>2\u3001\u670d\u52a1\u540d\u6709\u4ec0\u4e48\u9650\u5236\u5417\uff1f\u5141\u8bb8\u91cd\u540d\u5417\uff1f<\/h4>\n<p>\u51e0\u4e4e\u6ca1\u6709\uff0c\u4f60\u53ef\u4ee5\u7528\u4f60\u952e\u76d8\u80fd\u591f\u8f93\u5165\u7684\u4efb\u4f55\u5b57\u7b26\uff08\u5f00\u59cb\u8f6c\u6298\uff09\u9664\u4e86\u4fdd\u7559\u7528\u4e8e\u8def\u5f84\u5206\u5272\u7b26\u7684 \u201c\/\u201d\u3002\u81f3\u4e8e\u91cd\u540d\uff0c\u5141\u8bb8\uff0c\u5f53\u7136\u5141\u8bb8\u3002\u8fd9\u4e16\u754c\u4e0a\u8fd9\u4e48\u591a\u4eba\uff0c\u540d\u5b57\u91cd\u7684\u6d77\u4e86\u53bb\u4e86\uff0cQPlugins \u4e5f\u5141\u8bb8\u91cd\u540d\uff0c\u5305\u62ec ID \u4e5f\u53ef\u4ee5\u91cd\u3002\u5982\u679c\u6ca1\u6709\u8def\u7531\u5668\u62e6\u622a\uff0cByPath \/ ById \u4f1a\u8fd4\u56de\u7b2c\u4e00\u4e2a\u627e\u5230\u7684\u5b9e\u4f8b\u505a\u4e3a\u7ed3\u679c\uff0c\u6709\u4e86\u8def\u7531\u5668\uff0c\u5c31\u7531\u8def\u7531\u5668\u89c4\u5219\u8d1f\u8d23\u63a7\u5236\u4e86\u3002<\/p>\n<h4>3\u3001\u6211\u81ea\u5df1\u5199\u7684\u670d\u52a1\u5fc5\u9700\u6ce8\u518c\u5230 Services \u5206\u652f\u4e0b\u9762\u5417\uff1f<\/h4>\n<p>\u5f3a\u626d\u7684\u74dc\u4e0d\u751c\uff0c\u90ce\u60c5\u59be\u610f\u624d\u662f\u5b8c\u7f8e\u7684\u7ed3\u5c40\u3002\u6240\u4ee5\uff0cQPlugins \u4e0d\u4f1a\u9650\u5236\u4f60\u6ce8\u518c\u670d\u52a1\u5230\u90a3\u91cc\uff0c\u4f60\u53ef\u4ee5\u6ce8\u518c\u5230 QPlugins \u7684\u4efb\u4f55\u5206\u652f\u4e0b\u9762\uff0c\u751a\u81f3\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5206\u652f\u3002\u4e0d\u8fc7\uff0cQPlugins \u53ea\u662f\u4e00\u4e2a\u50bb\u50bb\u7684\u75f4\u7a0b\u5e8f\uff0c\u6240\u4ee5\uff0c\u8c03\u7528\u5b83\u7684 Start \u548c Stop \u65f6\uff0c\u53ea\u4f1a\u5728 Loaders \u4e0b\u9762\u627e\u5b9e\u73b0\u4e86 IQLoader \u63a5\u53e3\u7684\u670d\u52a1\uff0c\u800c ByPath \u65f6\uff0c\u53ea\u4f1a\u5728 Routers \u5206\u652f\u4e0b\u627e\u8def\u7531\u5668\u3002\u5982\u679c\u4f60\u4e0d\u8c03\u7528\u5b83\u7684\u63a5\u53e3\u6765\u5904\u7406\uff0c\u5f53\u7136\u53ef\u4ee5\u968f\u610f\uff0c\u6bd4\u5982\u4f60\u5c06\u52a0\u8f7d\u5668\u5168\u653e\u5230 \/MyLoaders \u5206\u652f\u4e0b\u9762\uff0c\u7136\u540e\u81ea\u5df1\u904d\u5386\u6bcf\u4e2a Loaders \u5e76\u52a0\u8f7d\u5b83\uff0c\u5728\u7a0b\u5e8f\u9000\u51fa\u524d\u518d\u6328\u4e2a\u5378\u8f7d\u5b83\u3002<\/p>\n<p>\u8fd9\u91cc\u5f3a\u8c03\u4e0b\uff0cQPlugins \u7ea6\u5b9a\u7684 Loaders \/ Routers \/Services \u53ea\u662f\u4e00\u4e2a\u5efa\u8bae\u7684\u6839\u7ed3\u70b9\uff0c\u5e76\u4e0d\u4ee3\u8868\u4f60\u6ca1\u6709\u81ea\u7531\u3002<\/p>\n<h4>4\u3001\u652f\u6301\u5355\u5b9e\u4f8b\u548c\u591a\u5b9e\u4f8b\u5417\uff1f<\/h4>\n<p>QPlugins \u4f53\u7cfb\u91cc\uff0c\u670d\u52a1\u7f16\u5199\u8005\u51b3\u5b9a\u63d0\u4f9b\u7684\u662f\u5355\u5b9e\u4f8b\u8fd8\u662f\u591a\u5b9e\u4f8b\u3002\u5982\u679c\u63d0\u4f9b\u7684\u662f\u5355\u5b9e\u4f8b\uff08\u9ed8\u8ba4\uff09\uff0c\u4e0d\u9700\u8981\u505a\u4efb\u4f55\u989d\u5916\u7684\u64cd\u4f5c\uff0c\u5982\u679c\u8981\u63d0\u4f9b\u591a\u5b9e\u73b0\uff0c\u5219\u9700\u8981\u91cd\u8f7d GetInstance \u65b9\u6cd5\u8fd4\u56de\u65b0\u5b9e\u4f8b\u3002\u7531\u6b64\u8fd9\u91cc\u5c31\u6709\u4e86\u4e00\u4e2a\u95ee\u9898\uff1a<\/p>\n<ul>\n<li>a. \u5982\u679c\u670d\u52a1\u7c7b\u578b\u662f\u4e00\u81f4\u7684\uff0c\u5e76\u4e14\u662f\u5355\u5b9e\u4f8b\u7684\uff0c\u90a3\u4e48\u6211\u4eec\u53ea\u9700\u8981\u7b80\u5355\u7684\u8fd4\u56de\u81ea\u8eab\u5c31\u597d\u4e86\uff08\u5b9e\u9645\u4e0aTQService\u7684\u9ed8\u8ba4 GetInstance \u5b9e\u73b0\u5c31\u662f\u8fd9\u6837\u5b50\u5e72\u7684\uff09\u3002<\/li>\n<li>\u00a0\u5982\u679c\u670d\u52a1\u7c7b\u578b\u662f\u4e00\u81f4\u7684\uff0c\u4f46\u8981\u6c42\u662f\u591a\u5b9e\u4f8b\u7684\uff0c\u90a3\u4e48\u6211\u4eec\u8fd4\u56de\u4e00\u4e2a\u65b0\u5efa\u7684\u5f53\u524d\u7c7b\u578b\u7684\u5b9e\u4f8b\u5c31\u597d\u4e86\u3002<\/li>\n<li>\u5982\u679c\u670d\u52a1\u7c7b\u578b\u662f\u4e0d\u81f4\u7684\uff0c\u5b9e\u9645\u662f\u7531\u53e6\u4e00\u4e2a\u670d\u52a1\u63d0\u4f9b\uff0c\u90a3\u4e48 GetInstance \u8fd4\u56de\u65b0\u7684\u670d\u52a1\u5c31\u597d\u4e86\u3002\u8fd9\u4e2a\u5b9e\u4f8b\u5b9e\u9645\u4e0a\u5c31\u662f\u5728\u4f7f\u7528\u65f6\u624d\u521b\u5efa\u7684\uff0c\u5982\u679c\u4f60\u613f\u610f\uff0c\u53ef\u4ee5\u81ea\u5efa\u7f13\u51b2\u6c60\uff0c\u4ece\u6c60\u4e2d\u53d6\uff0c\u8fd9\u5c31\u662f\u9898\u5916\u8bdd\u4e86\u3002<\/li>\n<\/ul>\n<h4>5\u3001QPlugins \u662f\u5426\u652f\u6301\u5de5\u5382\u6a21\u5f0f\uff1f<\/h4>\n<p>\u5de5\u5382\u6a21\u5f0f\u5b9e\u9645\u4e0a\u4e2a\u4eba\u611f\u89c9\u4e5f\u662f\u86ee\u6709\u4e89\u8bae\u7684\u4e00\u4e2a\u4e1c\u897f\uff0c\u5de5\u5382\u6a21\u5f0f\u9690\u85cf\u4e86\u7c7b\u7684\u7ec6\u8282\uff0c\u4ece\u800c\u53ea\u80fd\u5728\u4e00\u5b9a\u7684\u62bd\u8c61\u5c42\u6b21\u4e0a\u6765\u8003\u8651\u95ee\u9898\u3002\u51e1\u4e8b\u5c31\u662f\u4e24\u9762\uff0c\u6bc1\u8a89\u53ef\u53c2\u534a\u3002QPlugins \u5185\u6838\u4e0d\u8bd5\u56fe\u53bb\u533a\u5206\u8fd9\u4e9b\u4e1c\u897f\uff0c\u5728\u8bf7\u6c42\u670d\u52a1\u65f6\uff0cQPlugins \u53ef\u4ee5\uff1a<\/p>\n<ul>\n<li>\u901a\u8fc7 ByPath \u6765\u8bf7\u6c42\u670d\u52a1\uff1b<\/li>\n<li>\u901a\u8fc7 ById \u6765\u8bf7\u6c42\u670d\u52a1\uff1b<\/li>\n<li>\u901a\u8fc7 as \u64cd\u4f5c\u7b26\u6765\u8bf7\u6c42\u670d\u52a1\uff08\u5305\u62ec QueryInterface\u3001Supports\u7b49\uff09\uff1b<\/li>\n<\/ul>\n<p>\u5de5\u5382\u6a21\u5f0f\u5b9e\u9645\u4e0a\u5bf9\u5e94\u7684\u662f ByPath \u65b9\u5f0f<\/p>\n<pre class=\"lang:delphi decode:true\">PluginsManager.RequireService('Services\/Human')<\/pre>\n<p>\u4e0a\u9762\u4f1a\u8bf7\u6c42\u4e00\u4e2a Services\/Human \u670d\u52a1\uff0c\u800c\u5982\u679c\u6709\u8def\u7531\u5668\uff08\u00a0Routers \uff09 \u652f\u6301\uff0c\u5219\u53ef\u4ee5\u52a0\u5165\u4e00\u4e9b\u989d\u5916\u7684\u53c2\u6570\u548c\u7b5b\u9009\u64cd\u4f5c\uff0c\u5982\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">PluginsManager.RequireService('Services\/Human?type=woman')<\/pre>\n<p>\u63a5\u4e0b\u6765\u662f\u4e00\u4e2a\u597d\u6d88\u606f\uff0c\u4e00\u4e2a\u574f\u6d88\u606f\u3002\u597d\u6d88\u606f\u662f QPlugins \u672c\u8eab\u652f\u6301\u8def\u7531\u5668\u7684\u4ee3\u7801\u5df2\u7ecf\u5b9e\u73b0\uff0c\u574f\u6d88\u606f\u662f\u8def\u7531\u5668\u7684\u5b9e\u73b0\u4ee3\u7801\u76ee\u524d\u8fd8\u6ca1\u6709\u5199\uff0c\u9700\u8981\u7b49\u5f85\u5b83\u5b8c\u6210\u3002<\/p>\n<h4>6\u3001\u5176\u5b83\u7684\u95ee\u9898\uff1f<\/h4>\n<p>\u4f60\u60f3\u5230\u4e86\u518d\u95ee\uff0c\u4e0d\u95ee\u6211\u4e5f\u4e0d\u77e5\u9053\u3002\u7a0b\u5e8f\u5982\u679c\u6709 Bug \u5c31\u76f4\u63a5\u62a5\u544a Bug\uff0c\u6ca1 Bug \u5c31\u4e89\u53d6\u7528\u51fa Bug~~~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001QPlugins \u662f\u4ec0\u4e48\uff1f QPlu [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,9,50],"tags":[],"class_list":["post-2760","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-qdac","category-qplugin"],"views":5093,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2760","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2760"}],"version-history":[{"count":4,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2760\/revisions"}],"predecessor-version":[{"id":2763,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2760\/revisions\/2763"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}