<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Microholmes&#039;s Blog</title>
	<atom:link href="https://www.microholmes.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.microholmes.com</link>
	<description>我的知识分享</description>
	<lastBuildDate>Sun, 28 Nov 2021 16:05:26 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Nginx – 五、实用代理之proxy_cookie_domain</title>
		<link>https://www.microholmes.com/2020/12/15/nginx-%e4%ba%94%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_cookie_domain/</link>
					<comments>https://www.microholmes.com/2020/12/15/nginx-%e4%ba%94%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_cookie_domain/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Tue, 15 Dec 2020 14:51:34 +0000</pubDate>
				<category><![CDATA[Nginx]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=168</guid>

					<description><![CDATA[在使用nginx进行反向代理不同域名站点时，cookie也需要进行替换，才能被写入到浏览器中。通常在代理一些身 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>在使用nginx进行反向代理不同域名站点时，cookie也需要进行替换，才能被写入到浏览器中。通常在代理一些身份认证的站点时需要，如sso(单点登录)。</p>



<p>如xyz.test.com的域名，代理192.168.1.100，如不处理的话，仍然会返回path=192.168.1.100的cookie，而此时的请求地址是https://xyz.test.com，cookie是无法写入的。</p>



<p>当使用proxy_cookie_domain进行转换后，会将cookie的path替换成xyz.test.com，此时就可以顺利写入cookie了。</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>server {
  listen       443 ssl;
  server_name  xyz.test.com;

  ssl_certificate      cert/_test_com.pem;
  ssl_certificate_key  cert/_test_com.key;

  location / {
    proxy_cookie_domain 192.168.1.100 xyz.test.com;
    proxy_pass http://192.168.1.100/;
  }
}</pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/12/15/nginx-%e4%ba%94%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_cookie_domain/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nginx – 四、实用代理之sub_filter</title>
		<link>https://www.microholmes.com/2020/12/12/nginx-%e5%9b%9b%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bsub_filter/</link>
					<comments>https://www.microholmes.com/2020/12/12/nginx-%e5%9b%9b%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bsub_filter/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Sat, 12 Dec 2020 15:18:39 +0000</pubDate>
				<category><![CDATA[Nginx]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=140</guid>

					<description><![CDATA[sub_filter支持将返回内容（response body）中的内容进行替换。如返回内容中有跳转地址，比如 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>sub_filter支持将返回内容（response body）中的内容进行替换。如返回内容中有跳转地址，比如一些302跳转不是直接通过请求头中的Location，而是由表单自动提交的form，可将返回内容先进行替换，如把http://192.168.1.100更换为https://xyz.test.com，这样就方便地修改代理的跳转地址，不用修改代码。</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>sub_filter 'http://192.168.1.100' 'https://xyz.test.com';</pre></div>



<p>参考完整实例：</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>server {
  listen       443 ssl;
  server_name  xyz.test.com;
  ssl_certificate      cert/_test_com.pem;
  ssl_certificate_key  cert/_test_com.key;
  location / {
    proxy_redirect ~^http://192.168.1.100/(.*) https://xyz.test.com/$1;
    proxy_pass http://192.168.1.100/;
    sub_filter 'http://192.168.1.100' 'https://xyz.test.com';
    sub_filter_once off;
  }
}</pre></div>



<p>sub_filter_once on | off。默认: on，只执行一次。sub_filter指令是执行一次，还是重复执行。</p>



<h4 class="wp-block-heading">不生效处理办法</h4>



<p>增加配置：</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>proxy_set_header Accept-Encoding &quot;&quot;;</pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/12/12/nginx-%e5%9b%9b%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bsub_filter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nginx – 三、实用代理之proxy_redirect</title>
		<link>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%89%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_redirect/</link>
					<comments>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%89%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_redirect/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Tue, 08 Dec 2020 13:49:50 +0000</pubDate>
				<category><![CDATA[Nginx]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=138</guid>

					<description><![CDATA[proxy_redirect支持将返回头（response header）中的Location内容进行替换。请 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>proxy_redirect支持将返回头（response header）中的Location内容进行替换。请求头中的Location字段是302跳转的地址，浏览器会自动跳转到该字段配置的地址。</p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre>server {
  listen       443 ssl;
  server_name  xyz.test.com;

  ssl_certificate      cert/_test_com.pem;
  ssl_certificate_key  cert/_test_com.key;

  location / {
    proxy_redirect ~^http://192.168.1.100/(.*) https://xyz.test.com/$1;
    proxy_pass http://192.168.1.100/;
  }
}</pre></div>



<p>通常反向代理后，原网站的一些302跳转地址还是原来代理的地址（本文中指192.168.1.100），此时如果不想改动代码配置，可通过给nginx增加proxy_rediret配置，来替换location中的地址。</p>



<p>如原location为：http://192.168.1.100/index.html，可配置：</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>proxy_redirect ~^http://192.168.1.100/(.*) https://xyz.test.com/$1;</pre></div>



<p>配置后，访问后得到的地址会是：https://xyz.test.com/index.html。其中“~^”是使用正则的标志，“(.*)”表示其他内容，nginx自动填充到后面对应的“$1”中，如果有多个“(.*)”，则依次填写“$1”，“$2”，依次类推。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%89%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bproxy_redirect/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nginx – 二、实用代理之https</title>
		<link>https://www.microholmes.com/2020/12/08/nginx-%e4%ba%8c%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bhttps/</link>
					<comments>https://www.microholmes.com/2020/12/08/nginx-%e4%ba%8c%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bhttps/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Tue, 08 Dec 2020 13:36:52 +0000</pubDate>
				<category><![CDATA[Nginx]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=136</guid>

					<description><![CDATA[nginx可把http的站点反向代理为https的站点，只需要在nginx上配置对应的证书，及监听对应的端口。 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>nginx可把http的站点反向代理为https的站点，只需要在nginx上配置对应的证书，及监听对应的端口。</p>



<p>nginx也支持配置http2.0，具体配置可参考官方网站介绍或其他博客介绍。</p>



<p>以下展示nginx反向代理为https站点：<br>你必须具备以下物料：<br>1. 一个域名，如xyz.test.com;<br>2. 这个域名对应的证书，通常为pfx格式的证书，可通过openssl工具将其解析成pem和key两个证书文件；<br>3. 如需要浏览器认可证书，需要购买认可的ca证书，自己颁发的私有证书，现在的chrome浏览器（版本87.0.4280.88）通常会提示不安全，并拒绝访问，需要用户点击确认访问。</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre>server {
  listen 443 ssl;
  server_name xyz.test.com;

  ssl_certificate cert/_test_com.pem;
  ssl_certificate_key cert/_test_com.key;

  location / {
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://192.168.1.100/;

  sub_filter_once off;
  }
}</pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/12/08/nginx-%e4%ba%8c%e3%80%81%e5%ae%9e%e7%94%a8%e4%bb%a3%e7%90%86%e4%b9%8bhttps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nginx &#8211; 一、基本代理</title>
		<link>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%80%e3%80%81%e5%9f%ba%e6%9c%ac%e4%bb%a3%e7%90%86/</link>
					<comments>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%80%e3%80%81%e5%9f%ba%e6%9c%ac%e4%bb%a3%e7%90%86/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Tue, 08 Dec 2020 13:21:32 +0000</pubDate>
				<category><![CDATA[Nginx]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=133</guid>

					<description><![CDATA[nginx基本反向代理，常用于将内网站点代理开放给外网访问。 如外网https://xyz.test.com， [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>nginx基本反向代理，常用于将内网站点代理开放给外网访问。</p>
<p>如外网https://xyz.test.com，内网是http://192.168.1.100，代理如下:</p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre>server {
  listen       443 ssl;
  server_name  xyz.test.com;

  ssl_certificate      cert/_test_com.pem;
  ssl_certificate_key  cert/_test_com.key;

  location / {
    proxy_pass http://192.168.1.100/;
  }
}</pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/12/08/nginx-%e4%b8%80%e3%80%81%e5%9f%ba%e6%9c%ac%e4%bb%a3%e7%90%86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PowerDesigner &#8211; 物理数据模型(PDM)</title>
		<link>https://www.microholmes.com/2020/10/03/powerdesigner-%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8bpdm/</link>
					<comments>https://www.microholmes.com/2020/10/03/powerdesigner-%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8bpdm/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Sat, 03 Oct 2020 10:00:56 +0000</pubDate>
				<category><![CDATA[设计]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=102</guid>

					<description><![CDATA[一、创建表 在Physical Diagram中选择Table创建表 二、修改表显示 给表字段Stereoty [&#8230;]]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="102" class="elementor elementor-102">
						<section class="elementor-section elementor-top-section elementor-element elementor-element-d968dd9 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="d968dd9" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c1dc606" data-id="c1dc606" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-d6935de elementor-widget elementor-widget-image" data-id="d6935de" data-element_type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img decoding="async" src="https://www.microholmes.com/wp-content/uploads/2020/10/powerdesigner01.png" title="" alt="" loading="lazy" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-95dc5be elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="95dc5be" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e6650ee" data-id="e6650ee" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ab3b17b elementor-widget elementor-widget-text-editor" data-id="ab3b17b" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<h4>一、创建表</h4><p>在Physical Diagram中选择Table创建表</p><h4>二、修改表显示</h4><p>给表字段Stereotype输入中文表名，再修改表显示列，显示Stereotype。</p><h4>三、修改字段显示</h4><p>选择表格显示的字段code、name。操作如下：</p><p>菜单栏选择Tools -&gt; Display Preferences -&gt; General Settings -&gt; Table -&gt; Content -&gt; Advanced -&gt; Form -&gt; Columns -&gt; List columns -&gt; 选择放大镜(Select) -&gt; 勾选Attribute Name 为Code、Name的Displayed列，可上下移动显示顺序。</p><p>Code：一般为英文编码；<br />Name：一般为中文注释。</p><h4>四、输出SQL脚本</h4><p>右键点击要输出的表，点击“SQL Preview”菜单，由于表在创建的时候已选择数据库类型，这里会直接显示对应数据库的脚本。</p><p> </p>								</div>
				</div>
				<div class="elementor-element elementor-element-dcb5d45 elementor-widget elementor-widget-image" data-id="dcb5d45" data-element_type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img decoding="async" src="https://www.microholmes.com/wp-content/uploads/2020/10/powerdesigner02-1.png" title="" alt="" loading="lazy" />															</div>
				</div>
				<div class="elementor-element elementor-element-b9d1689 elementor-widget elementor-widget-image" data-id="b9d1689" data-element_type="widget" data-widget_type="image.default">
				<div class="elementor-widget-container">
															<img decoding="async" src="https://www.microholmes.com/wp-content/uploads/2020/10/powerdesigner03.png" title="" alt="" loading="lazy" />															</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				</div>
		]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/10/03/powerdesigner-%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8bpdm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IOC探讨二 &#8211; 场景</title>
		<link>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%ba%8c-%e5%9c%ba%e6%99%af/</link>
					<comments>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%ba%8c-%e5%9c%ba%e6%99%af/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Mon, 14 Sep 2020 14:20:03 +0000</pubDate>
				<category><![CDATA[IOC]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=64</guid>

					<description><![CDATA[IOC探讨二 &#8211; 场景 一、作用域变量 （1）介绍 在网站/API开发时，有记录操作日志、异常日志 [&#8230;]]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="64" class="elementor elementor-64">
						<section class="elementor-section elementor-top-section elementor-element elementor-element-6b178c6 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="6b178c6" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c72c887" data-id="c72c887" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-0f483dc elementor-widget elementor-widget-heading" data-id="0f483dc" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h3 class="elementor-heading-title elementor-size-default">IOC探讨二 - 场景</h3>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-06a7f2a elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="06a7f2a" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1d3710c" data-id="1d3710c" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-7b1b4ec elementor-widget elementor-widget-text-editor" data-id="7b1b4ec" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<h4>一、作用域变量</h4><h6>（1）介绍</h6><p>在网站/API开发时，有记录操作日志、异常日志等需求。这时需要统一的记录点，通常日志记录点会与方法分开，比如dotnet core用中间件来记录日志，但此时常常难以取得方法中的一些参数。系统拥有三层架构，但接口的参数往往难以透传到业务层/数据访问层等，中间件也难以取得对应的参数。</p><p>使用DI，可以通过定义作用域，以构造函数注入的方式，将数据透传到需要的任意代码位置，非常类似内存缓存，而且由DI来控制对象的释放、创建，就不需要像控制内存缓存那样，还需要考虑释放对象的时机。</p><h6>（2）代码实例（dotnet core）</h6>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-d070773 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="d070773" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e0ed390" data-id="e0ed390" data-element_type="column">
			<div class="elementor-widget-wrap">
							</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-85d30ae elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="85d30ae" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-78e399b" data-id="78e399b" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-ff366c0 elementor-widget elementor-widget-text-editor" data-id="ff366c0" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<h4>二、实例化复杂构造函数对象</h4><h6>（1）介绍</h6><p>实际业务编码过程中，可能存在一些构造函数包含多个对象参数的类对象，传统方式在实例化该对象前，需要预先实例化各个参数对象，才能实例化该对象。</p><p>引入DI，则可以直接方便快捷地实例化对象，大大降低代码的复杂度，从某种程度上来说，使代码更为简约优美。</p><h6>（2）代码实例（dotnet core）</h6>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-d90966b elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="d90966b" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0a64405" data-id="0a64405" data-element_type="column">
			<div class="elementor-widget-wrap">
							</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-6aba656 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="6aba656" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a4e5023" data-id="a4e5023" data-element_type="column">
			<div class="elementor-widget-wrap">
							</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-3ac2f07 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="3ac2f07" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a8e3ba6" data-id="a8e3ba6" data-element_type="column">
			<div class="elementor-widget-wrap">
							</div>
		</div>
					</div>
		</section>
				</div>
		]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%ba%8c-%e5%9c%ba%e6%99%af/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>IOC探讨一 &#8211; 概念</title>
		<link>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%b8%80-%e6%a6%82%e5%bf%b5/</link>
					<comments>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%b8%80-%e6%a6%82%e5%bf%b5/#respond</comments>
		
		<dc:creator><![CDATA[Microholmes]]></dc:creator>
		<pubDate>Mon, 14 Sep 2020 01:25:58 +0000</pubDate>
				<category><![CDATA[IOC]]></category>
		<guid isPermaLink="false">http://www.microholmes.com/?p=44</guid>

					<description><![CDATA[IOC探讨一 – 概念 一、什么是IOC？ 控制反转（Inversion of Control），是一种设计思 [&#8230;]]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="44" class="elementor elementor-44">
						<section class="elementor-section elementor-top-section elementor-element elementor-element-2fb6235 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="2fb6235" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b7bdb75" data-id="b7bdb75" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-a457467 elementor-widget elementor-widget-heading" data-id="a457467" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
					<h3 class="elementor-heading-title elementor-size-default">IOC探讨一 – 概念</h3>				</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-07f22e4 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="07f22e4" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a4bc435" data-id="a4bc435" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-06841d4 elementor-widget elementor-widget-text-editor" data-id="06841d4" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<h4>一、什么是IOC？</h4><p>控制反转（Inversion of Control），是一种设计思想。体现了“好莱坞法则”（Hollywood Principle），不要给我们打电话，我们会给你打电话（don‘t call us, we‘ll call you）</p><p>实现IOC的技术手段主要包括：</p><p>（1）DI，Dependency Injection，依赖注入；</p><p>（2）DL，Dependency Lookup，依赖查找。</p><p>其中DL包括：</p><p>（1）DP，Dependency Pull，依赖拖拽；</p><p>（2）CDL，Contextualized Dependency Lookup，上下文依赖查找。</p><h4>二、为什么要用IOC？</h4><p>（1）对象的实例化复杂，实例化一个对象时往往需要同时实例化多个对象，令人头疼；</p><p>（2）IOC可以协助托管对象的实例化和释放，应用程序只需要关心消费即可；</p><p>（3）IOC便于解耦，由容器维护接口的具体对象实现。</p><h4>三、IOC能做什么？</h4><p>（1）解耦程序，方便测试，利于功能复用；</p><p>（2）可以让程序的体系结构变得非常灵活；</p><p>（3）便于数据的透传。</p><h4>四、DI怎么实现(C#/dotnet core)？</h4><p>（1）Constructor Injection，构造器注入</p><p>（2）Setter Injection</p>								</div>
				</div>
				<div class="elementor-element elementor-element-b3ec407 elementor-widget-divider--view-line elementor-widget elementor-widget-divider" data-id="b3ec407" data-element_type="widget" data-widget_type="divider.default">
				<div class="elementor-widget-container">
							<div class="elementor-divider">
			<span class="elementor-divider-separator">
						</span>
		</div>
						</div>
				</div>
				<div class="elementor-element elementor-element-de8caa5 elementor-widget elementor-widget-text-editor" data-id="de8caa5" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
									<p><em><strong>参考：</strong></em></p><p><em>[1] <a href="https://blog.csdn.net/ivan820819/article/details/79744797">浅谈IOC&#8211;说清楚IOC是什么</a> ，ivan820819，CSDN，2018-03</em></p><p><em>[2] <a href="https://blog.csdn.net/qq_42709262/article/details/81951402">什么是IOC(控制反转)、DI(依赖注入)</a> ，Ming339456，CSDN，2018-08</em></p>								</div>
				</div>
					</div>
		</div>
					</div>
		</section>
				</div>
		]]></content:encoded>
					
					<wfw:commentRss>https://www.microholmes.com/2020/09/14/ioc%e6%8e%a2%e8%ae%a8%e4%b8%80-%e6%a6%82%e5%bf%b5/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
