<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_陳龑（飛龍在天）</title><subtitle type="text">Get busy living, Or get busy dying.</subtitle><id>http://feed.cnblogs.com/blog/u/27441/rss</id><updated>2011-10-14T09:57:04Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/27441/rss"/><entry><id>http://www.cnblogs.com/chy8219/archive/2011/05/04/2036028.html</id><title type="text">Page类与Control类的生命周期(life cycle)比较总结[转]</title><summary type="text">最近一段时间在使用Microsoft SharePoint2007，进行开发一个Document管理系统，里面有使用SharePoint Designer设计Page布局，需要使用自定义开发的Webpart控件，由于本来就没有进行搞控件开发了，再加上有句名言“知识就是力量”，那没得知识就没得力量了，所以没得办法，就利用Baidu + Google,googling了半下午。结果再次验证了Google的搜索实力确实比Baidu强悍啊，在此为Google最近的决定感到失望，牢骚就不多发了，还是进正题。以下是自己的一些新的总结和找到的一些学习资源。希望可以share下.首先了解到，Page类继承自模</summary><published>2011-05-03T16:24:00Z</published><updated>2011-05-03T16:24:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2011/05/04/2036028.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2011/05/04/2036028.html"/><content type="html">&lt;div&gt;&lt;span style="font-family: verdana, sans-serif; "&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-indent: 18pt; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;最近一段时间在使用&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Microsoft SharePoint2007&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;，进行开发一个&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Document&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;管理系统，里面有使用&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;SharePoint Designer&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;设计&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Page&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;布局，需要使用自定义开发的&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Webpart&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;控件，由于本来就没有进行搞控件开发了，再加上有句名言&amp;#8220;知识就是力量&amp;#8221;，那没得知识就没得力量了，所以没得办法，就利用&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Baidu + Google,googling&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;了半下午。结果再次验证了&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Google&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;的搜索实力确实比&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Baidu&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;强悍啊，在此为&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Google&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;最近的决定感到失望，牢骚就不多发了，还是进正题。以下是自己的一些新的总结和找到的一些学习资源。希望可以&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;share&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;下&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-indent: 22.5pt; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;首先了解到，&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Page&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;类继承自模板控件类&lt;/span&gt;&lt;span style="line-height: 21px; font-family: 'Times New Roman'; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;TemplateControl&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;和&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Http&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;处理程序接口&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;IHttpHandler&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;1&lt;strong&gt;.TemplateContro&lt;/strong&gt;l&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;类是个&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;abstract&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;类，继承自&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Control&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;类，&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;ID&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;命名容器控件&lt;/span&gt;&lt;span style="line-height: 21px; font-family: 'Times New Roman'; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;INamingContainer&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;和设备筛选器接口&lt;/span&gt;&lt;span style="line-height: 21px; font-family: 'Times New Roman'; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;IFilterResolutionServic&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;e&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;2.&lt;strong&gt;&amp;nbsp;IHttpHandler&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;接口是为了使用&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Http&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;处理程序同步处理&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Http Web&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;请求而实现的协定。有一个只&lt;/span&gt;&lt;span style="line-height: 18px; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 'Times New Roman'; "&gt;Set&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; font-size: 9pt; "&gt;的&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;IsReusable&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;属性和一个方法&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;ProcessRequest(HttpContext context)&lt;/span&gt;&lt;/strong&gt;方法&lt;span style="line-height: 18px; "&gt;,&lt;/span&gt;用来处理&lt;span style="line-height: 18px; "&gt;Http Web&lt;/span&gt;请求。&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;既然&lt;span style="line-height: 18px; "&gt;Page&lt;/span&gt;间接的继承自&lt;span style="line-height: 18px; "&gt;Control&lt;/span&gt;类，那下面就先从介绍&lt;span style="line-height: 18px; "&gt;Control&lt;/span&gt;类说起。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 22.15pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类的生命周期有七个大的事件阶段，分别为&lt;span style="line-height: 18px; "&gt;Init&lt;/span&gt;事件，&lt;span style="line-height: 18px; "&gt;Load&lt;/span&gt;事件，&lt;span style="line-height: 18px; "&gt;DataBinding&lt;/span&gt;事件，&lt;span style="line-height: 18px; "&gt;PreRender&lt;/span&gt;事件，&lt;span style="line-height: 18px; "&gt;Render&lt;/span&gt;方法，&lt;span style="line-height: 18px; "&gt;Unload&lt;/span&gt;事件，&lt;span style="line-height: 18px; "&gt;Disposed&lt;/span&gt;事件。下面简单介绍下每个阶段；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;1&lt;strong&gt;.Init&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，引发&lt;span style="line-height: 18px; "&gt;Init&lt;/span&gt;事件，执行&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;OnInit&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;(EventArgs e)&lt;/span&gt;虚方法。详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;请参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconeventsinheritedfromcontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;处理继承的事件。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;2.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;然后执行&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;TrackViewState(&lt;span style="line-height: 18px; color: blue; "&gt;object&lt;/span&gt;&amp;nbsp;savedState)&lt;/span&gt;&lt;/strong&gt;虚方法，会根据页面&lt;span style="line-height: 18px; "&gt;IsPostBack&lt;/span&gt;属性，来确定是否&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;LoadViewState&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;(objcet savedState)&lt;/span&gt;来加载视图状态&lt;span style="line-height: 18px; "&gt;,&lt;/span&gt;以及如果控件继承自接口&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;IPostBackDataHandler&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;,&lt;/span&gt;还会实现&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;LoadPostData(&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; color: blue; "&gt;string&lt;/span&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;postDataKey,&lt;span style="line-height: 18px; color: teal; "&gt;System.Collections.Specialized.NameValueCollection&lt;/span&gt;&amp;nbsp;postCollection&lt;strong&gt;)&lt;/strong&gt;,&lt;/span&gt;来处理回发数据。详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;请参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconreceivingpostbackdatachangednotifications.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;处理回发数据&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;和&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconmantainingstateincontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;维护控件中的状态&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;3.&lt;strong&gt;Load&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，引发&lt;span style="line-height: 18px; "&gt;Load&lt;/span&gt;事件，执行&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;OnLoad&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;(EventArgs e)&lt;/span&gt;虚方法。此时，&lt;span style="line-height: 18px; "&gt;Load&lt;/span&gt;事件树中的服务器控件已创建并初始化、状态已还原并且窗体控件反映了客户端的数据。详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconeventsinheritedfromcontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;处理继承的事件。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;4.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;之后根据页面&lt;span style="line-height: 18px; "&gt;IsPostBack&lt;/span&gt;属性，如果实现了接口&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;IPostBackDataHandler&lt;/span&gt;，&lt;/strong&gt;则调用&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;RaisePostDataChangedEvent()&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;,&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;来处理引发更改事件以响应当前和以前回发之间的状态更改。如果实现如果已实现&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;IPostBackEventHandler&lt;/span&gt;&lt;/strong&gt;接口，则引发&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;RaisePostBackEvent&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;(&lt;span style="line-height: 18px; color: blue; "&gt;string&lt;/span&gt;&amp;nbsp;eventArgument)&lt;/span&gt;方法的实现来处理，来&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;处理引起回发的客户端事件，并在服务器上引发相应的事件。&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconreceivingpostbackdatachangednotifications.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;处理回发数据&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;和&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconreceivingpostbackeventnotifications.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;捕获回发事件。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;5.&lt;strong&gt;PreRender&lt;/strong&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;阶段，引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;PreRender&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;OnPreRender&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;(EventArgs e)&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法，&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在呈现输出之前执行任何更新。可以保存在预呈现阶段对控件状态所做的更改，而在呈现阶段所对的更改则会丢失。此阶段是对控件做任何更新的最后机会。详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;请参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconeventsinheritedfromcontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;处理继承的事件。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;6.&lt;strong&gt;SaveViewState&lt;/strong&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段，&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;在此阶段后，自动将控件的&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;View State&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;属性保持到字符串对象中。此字符串对象被发送到客户端并作为隐藏变量发送回来。为了提高效率，控件可以重写&lt;/span&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;SaveViewState()&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法以修改&lt;/span&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;View State&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;属性。&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;请参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconmantainingstateincontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;维护控件中的状态。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;7&lt;strong&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;呈现&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;，此阶段没有不适事件，执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;Render()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;,&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;来生成呈现给客户端的输出。&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconrenderingwebformscontrol.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;呈现&lt;/span&gt;&lt;/span&gt;&amp;nbsp;ASP.NET&amp;nbsp;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;服务器控件&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;8.&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Dispose&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;,&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Disponse()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法，执行销毁控件前的所有最终清理操作。在此阶段必须释放对昂贵资源的引用，如数据库链接。&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;详细&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconmethodsinwebformscontrols.asp" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;ASP.NET&amp;nbsp;&lt;span style="line-height: 18px; font-family: 宋体; "&gt;&lt;span style="line-height: 18px; "&gt;服务器控件中的方法&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;9.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;卸载&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Unload&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;阶段，引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;Unload&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;事件，执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;OnUnload()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法，来执行销毁控件前的所有最终清理操作。控件作者通常在&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&amp;nbsp;Dispose&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;中执行清除，而不处理此事件。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;以下&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;2&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;点要有所注意&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;1.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;要重写&lt;/span&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Event Name&lt;/span&gt;&lt;/strong&gt;&lt;em style="font-style: italic; "&gt;&amp;nbsp;&lt;/em&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;事件，请重写&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;On&lt;/span&gt;&lt;/strong&gt;&lt;em style="font-style: italic; "&gt;&lt;span style="line-height: 18px; "&gt;EventName&amp;nbsp;&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;方法（并调用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;&amp;nbsp;base.&lt;strong&gt;On&lt;/strong&gt;&lt;em style="font-style: italic; "&gt;EventName&lt;/em&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;）。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;2.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;之上的方法和事件基本在自己创建控件时都可以重写&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;System.Web.UI.Control&lt;/span&gt;&lt;/strong&gt;的&lt;span style="line-height: 18px; "&gt;abstract&lt;/span&gt;方法，但可以看出以下几个除外：&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;LoadPostData&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;和&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;RaisePostDataChangedEvent&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;是&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;IPostBackDataHandler&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;接口的方法，而&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;RaisePostBackEvent&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;属于&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;IPostBackEventHandler&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;接口。如果控件参与回发数据处理，则必须实现&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;IPostBackDataHandler&lt;/span&gt;&lt;/strong&gt;。如果控件收到回发事件，则必须实现&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;IPostBackEventHandle&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; "&gt;r&lt;/span&gt;。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Tahoma; color: #333333; font-size: 9pt; "&gt;3.&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 宋体; color: #333333; font-size: 9pt; "&gt;以上&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;没有列出&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;CreateChildControls&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;方法，这是由于每当&lt;span style="line-height: 18px; "&gt;&amp;nbsp;ASP.NET&amp;nbsp;&lt;/span&gt;页框架需要创建控件树时就会调用该方法，且该方法调用并不限于控件生命周期的特定阶段。例如，可以在加载页时、在绑定数据过程中或者在呈现过程中调用&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;CreateChildControls&lt;/span&gt;&lt;/strong&gt;，以及在动态创建控件的时候也可以调用的。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 9pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;下面给个自己创建个&lt;span style="line-height: 18px; "&gt;WebPart&lt;/span&gt;控件示范，功能比较简单，在页面上面实现&lt;span style="line-height: 18px; "&gt;Ifame&lt;/span&gt;实现内嵌页面的效果。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 9pt; "&gt;&lt;/p&gt;&lt;div "="" style="font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; background-color: #e7e5dc; width: 933px; overflow-x: auto; overflow-y: auto; margin-top: 18px !important; margin-right: 0px !important; margin-bottom: 18px !important; margin-left: 0px !important; padding-top: 1px; "&gt;&lt;div style="padding-left: 45px; "&gt;&lt;div style="padding-top: 3px; padding-right: 8px; padding-left: 10px; font: normal normal normal 9px/normal Verdana, Geneva, Arial, Helvetica, sans-serif; color: silver; background-color: #f8f8f8; padding-bottom: 10px; border-left-width: 3px; border-left-style: solid; border-left-color: #6ce26c; "&gt;&lt;a href="http://blog.csdn.net/masky5310/archive/2010/01/21/5219222.aspx#" style="text-decoration: none; color: #a0a0a0; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; "&gt;view plain&lt;/a&gt;&lt;a href="http://blog.csdn.net/masky5310/archive/2010/01/21/5219222.aspx#" style="text-decoration: none; color: #a0a0a0; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; "&gt;copy to clipboard&lt;/a&gt;&lt;a href="http://blog.csdn.net/masky5310/archive/2010/01/21/5219222.aspx#" style="text-decoration: none; color: #a0a0a0; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; "&gt;print&lt;/a&gt;&lt;a href="http://blog.csdn.net/masky5310/archive/2010/01/21/5219222.aspx#" style="text-decoration: none; color: #a0a0a0; background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: inherit; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 0px; font-size: 9px; background-position: initial initial; background-repeat: initial initial; "&gt;?&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;ol start="1" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 1px !important; margin-left: 45px !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: decimal; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; list-style-position: initial; list-style-image: initial; background-color: #ffffff; color: #5c5c5c; "&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Collections.Generic;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Text;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Web;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Web.UI;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Web.UI.HtmlControls;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;using&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;System.Web.UI.WebControls.WebParts;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;namespace&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;IframeWebpart&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;class&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;Iframe:WebPart,INamingContainer&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;int&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_width&amp;nbsp;=&amp;nbsp;100;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;int&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_height&amp;nbsp;=&amp;nbsp;100;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;private&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;HtmlTableCell&amp;nbsp;_htc&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;HtmlTableCell();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;string&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_url&amp;nbsp;=&amp;nbsp;@&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"http://www.baidu.com"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[WebBrowsable(&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;),Personalizable(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;)]&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;int&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;IWidth&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;get&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;return&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_width;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;set&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;_width&amp;nbsp;=&amp;nbsp;value;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[WebBrowsable(&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;),Personalizable(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;)]&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;int&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;IHeight&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;get&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;return&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_height;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;set&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;_height&amp;nbsp;=&amp;nbsp;value;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[WebBrowsable(&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;),&amp;nbsp;Personalizable(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;true&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;)]&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;string&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;Url&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;get&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;return&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;_url;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;set&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;{&amp;nbsp;_url&amp;nbsp;=&amp;nbsp;value;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;void&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;CreateChildControls()&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #008200; background-color: inherit; "&gt;//base.CreateChildControls();&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;table&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;td&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;._htc);&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;/td&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;/table&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;if&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;(!&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Page.IsPostBack)&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.AddControls();&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;void&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;OnLoad(EventArgs&amp;nbsp;e)&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;base&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.OnLoad(e);&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #008200; background-color: inherit; "&gt;//if&amp;nbsp;(!this.Page.IsPostBack)&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #008200; background-color: inherit; "&gt;//{&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #008200; background-color: inherit; "&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.AddControls();&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #008200; background-color: inherit; "&gt;//}&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;protected&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;override&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;void&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;Render(HtmlTextWriter&amp;nbsp;writer)&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;base&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.Render(writer);&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;void&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;AddControls()&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;._htc.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;iframe&amp;nbsp;id='iframe1'&amp;nbsp;src="&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"+this.Url+"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;nbsp;mce_src="&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"+this.Url+"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;nbsp;width='"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.IWidth+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"'&amp;nbsp;height='"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;.IHeight+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"'&amp;nbsp;&amp;nbsp;marginheight='0'&amp;nbsp;frameborder='0'&amp;nbsp;scrolling='no'&amp;nbsp;vspace='0'&amp;nbsp;hspace='0'&amp;nbsp;&amp;nbsp;marginwidth='0'&amp;nbsp;&amp;nbsp;&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;this&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;._htc.Controls.Add(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: #006699; background-color: inherit; font-weight: bold; "&gt;new&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;LiteralControl(&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"&amp;lt;/iframe&amp;gt;"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;+&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: blue; background-color: inherit; "&gt;"\n"&lt;/span&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;));&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #f8f8f8; color: #5c5c5c; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; list-style-type: decimal-leading-zero; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-width: initial; border-color: initial; list-style-image: initial; list-style-position: outside !important; border-left-width: 3px; border-left-color: #6ce26c; background-color: #ffffff; color: inherit; line-height: 14px; "&gt;&lt;span style="line-height: 18px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; color: black; background-color: inherit; "&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类的比较简单，下面介绍&lt;span style="line-height: 18px; "&gt;Page&lt;/span&gt;类，&lt;span style="line-height: 18px; "&gt;Page&lt;/span&gt;类的生命周期相对&lt;span style="line-height: 18px; "&gt;control&lt;/span&gt;要稍微复杂一些。&lt;span style="line-height: 18px; "&gt;(&lt;/span&gt;下面介绍参考了&lt;span style="line-height: 18px; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/ms178472(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;MSDN&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;上面的介绍&lt;span style="line-height: 18px; "&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 22.5pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;普通的常规页面生命周期有&lt;span style="line-height: 18px; "&gt;:&lt;/span&gt;页请求&lt;span style="line-height: 18px; "&gt;,&lt;/span&gt;开始阶段，初始化，加载，验证，回发事件处理，呈现，卸载，除了页生命周期阶段以外，在请求前后还存在应用程序阶段，但是这些阶段并不特定于页。以下详细介绍；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;1&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;页请求&lt;/strong&gt;：发生在页面生命周期之前，用户请求页时，&lt;span style="line-height: 18px; "&gt;ASP.NET&lt;/span&gt;将确定是否需要分析和编译页，从而确定是否开始页面的生命周期，或者是否可以在不运行页的情况下发送页面缓存以进行响应。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;2&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;开始&lt;/strong&gt;：设置页属性，如：&lt;span style="line-height: 18px; "&gt;HttpContext&lt;/span&gt;以及其他属性；在此阶段，页面需要确定是回发请求还是新请求，并设置&lt;span style="line-height: 18px; "&gt;IsPostBack&lt;/span&gt;属性；设置页面的&lt;span style="line-height: 18px; "&gt;UICulture&lt;/span&gt;属性。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;3&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;页面初始化&lt;/strong&gt;：加载所有主题；控件生成，并设置&lt;span style="line-height: 18px; "&gt;UniqueID&lt;/span&gt;；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;注：&lt;span style="line-height: 18px; "&gt;ViewState&lt;/span&gt;、&lt;span style="line-height: 18px; "&gt;ControlState&lt;/span&gt;中的值还未加载至控件；如果页面是回发，则回发数据也还未加载；故此时控件可以访问，但值可能出错。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;4&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;加载&lt;/strong&gt;：如果当前请求是回发请求，则为控件加载&lt;span style="line-height: 18px; "&gt;ViewState&lt;/span&gt;和&lt;span style="line-height: 18px; "&gt;ControlState&lt;/span&gt;中的值。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;5&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;验证&lt;/strong&gt;：调用所有验证程序控件的&lt;span style="line-height: 18px; "&gt;Validate&lt;/span&gt;方法，此方法将设置验证程序控件和页的&lt;span style="line-height: 18px; "&gt;IsValid&lt;/span&gt;属性。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;6&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;回发事件处理&lt;/strong&gt;：如果请求是回发请求，则调用所有事件处理程序。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;7&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;呈现&lt;/strong&gt;：首先对该页和所有控件进行保存视图状态，然后对每个控件调用&lt;span style="line-height: 18px; "&gt;Render&lt;/span&gt;方法，它会提供一个文本编写器，用于将控件的输入写入页的&lt;span style="line-height: 18px; "&gt;Response&lt;/span&gt;属性的&lt;span style="line-height: 18px; "&gt;OutputStream&lt;/span&gt;中。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;8&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;、&lt;strong&gt;卸载&lt;/strong&gt;：完成呈现，并已将页发送至客户端、准备丢弃该页后，调用卸载。将卸载属性如：&lt;span style="line-height: 18px; "&gt;Response&lt;/span&gt;和&lt;span style="line-height: 18px; "&gt;Request&lt;/span&gt;等等，故之后如果在调用这些对象，都将出错异常的。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在介绍&lt;span style="line-height: 18px; "&gt;Asp.net&lt;/span&gt;之前先来看两张关于页面的请求过程图片：&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&lt;img src="http://hi.csdn.net/attachment/201001/21/119493_1264037757qErP.jpg" alt="" width="1280" height="1024" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&lt;img src="http://hi.csdn.net/attachment/201001/21/119493_1264037758tg88.jpg" alt="" width="1280" height="994" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;第一张是个普通的页面请求过程&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;第二张是个是个添加的&lt;span style="line-height: 18px; "&gt;Button&lt;/span&gt;按钮控件&lt;span style="line-height: 18px; "&gt;PostBack&lt;/span&gt;后的页面请求过程。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;比较这两张图片可以很清晰的得出以下两点内容。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;一．&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Asp.Net&lt;/span&gt;的页面生命周期，基本都有如下几个阶段；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreInit&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Init&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;InitComplete&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreLoad&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Load&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;LoadComplete&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreRender&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;RenderComplete&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;SaveState&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;SaveStateComplete&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 21pt; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;UnLoad&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;，&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;二．&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在页面的响应生命周期阶段，控件的生命周期阶段也在相应同步进行着。&lt;/span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;下面也来个粗略的介绍；&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;1.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreInit&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;此阶段引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreInit&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnPreInit()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，完成的操作，有比如查&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;IsPostBack&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;属性来确定是&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;不是第一次处理该页；创建或重新创建动态控件，动态设置主控页，动态设置&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Theme&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;属性，读取或设置配置文件属性。注：如果请求是回发请求，则控件的值尚未从视图状态恢复，即：不应该在此事件中设置控件属性。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;2.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Init&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 18pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在所有控件都已初始化，且应用了外观后由里到外引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Init&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行由自&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类继承得&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnInit()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，使用该事件来读取或初始化控件属性。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;3.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;InitComplete&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;阶段&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 18pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;由&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.page(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;Page&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;对象引发。使用该事件来处理要求先完成所有初始化工作的任务。执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnInitComplete()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;4.&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;PreLoad&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 18pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Page&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发该事件后，执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnPreLoad(),&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;它会为自身和所有控件加载视图状态，然后会处理&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Request&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;实例包括的任何回发数据，如果需要在&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.control.load(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;Load&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件之前对页或控件执行处理，请使用该事件。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;5.&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Load&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;在&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;上调用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.control.onload(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;OnLoad&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件方法，然后以递归方式对每个子控件执行相同操作，如此循环往复，直到加载完本页和所有控件为止。使用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnLoad&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件方法来设置控件中的属性并建立数据库连接。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;6.&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;控件事件&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 21pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;使用这些事件来处理特定控件事件，如&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;Button&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;控件的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.button.click(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;Click&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件等。注：在回发请求中，如果页包含验证程序控件，请在执行任何处理之前检查&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;和各个验证控件的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;IsValid&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;属性。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;7.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;LoadComplete&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 13.5pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;LoadComplete&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnLoadComplete()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，对需要加载页上的所有其他控件的任务使用该事件。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;8.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreRender&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 13.5pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreRender&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行由&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类继承来的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnPreRender()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，使用该事件对页或其控件的内容进行最后更改。注：在该事件发生前的操作：&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;对所有控件递归进行&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;EnsureChildControl&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;操作设置了&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;DataSourceID&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;属性的数据绑定控件会调用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;DataBind&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;9.&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;PreRenderComplete&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;PreRenderComplete&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;On PreRenderComplete&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.7pt; text-align: left; text-indent: -17.7pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;10.&amp;nbsp;&amp;nbsp;SaveStateComplete&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;SaveStateComplet&lt;strong&gt;e&lt;/strong&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行由&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;OnSaveStateComplete(&lt;span style="line-height: 18px; color: teal; "&gt;EventArgs&lt;/span&gt;&amp;nbsp;e)&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，在该事件发生前，&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.65pt; text-align: left; text-indent: -17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;已针对页和所有控件保存了&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.control.viewstate(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;ViewState&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;。将忽略此时对页或控件进行的任何更改。。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.7pt; text-align: left; text-indent: -17.7pt; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;11&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;．&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;这不是事件；在处理的这个阶段，&lt;/span&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;对象会在每个控件上调用此方法。所有&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;ASP.NET Web&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;服务&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.65pt; text-align: left; text-indent: -17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;器控件都有一个用于写出发送给浏览器的控件标记的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。如果创建自定义控件，通常要重写此&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.65pt; text-align: left; text-indent: -17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法以输出控件的标记。不过，如果自定义控件只合并标准的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;ASP.NET Web&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;服务器控件，不合并自定&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.65pt; text-align: left; text-indent: -17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;义标记，则不需要重写&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;strong&gt;&lt;span style="line-height: 18px; "&gt;Render&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。有关更多信息，请参见&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/zt27tfhy(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;开发自定义&lt;/span&gt;&lt;/span&gt;&amp;nbsp;ASP.NET&amp;nbsp;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;服务器控件&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;。用户&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 17.65pt; text-align: left; text-indent: -17.65pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;控件（&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;.ascx&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;文件）自动合并呈现，因此不需要在代码中显式呈现该控件&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;12.Unload&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; text-indent: 22.5pt; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;引发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Unload&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件，执行由&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类继承来的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;OnUnLoad()&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，对子控件由里向外执行此方法。&lt;/span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;注意点&lt;/span&gt;&lt;/strong&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;。当从&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Page&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类继承类时，除了可以处理由页引发的事件以外，还可以重写页的基类中的方法。例如，可以重写页的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;&lt;a href="http://msdn.microsoft.com/zh-cn/library/system.web.ui.page.initializeculture(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;InitializeCulture&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，以便动态设置区域性信息。注意，在使用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Page_&lt;/span&gt;&lt;/span&gt;&lt;em style="font-style: italic; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;事件&lt;/span&gt;&lt;/em&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;语法创建事件处理程序时，将隐式调用基实现，因此无需在方法中调用它。例如，无论是否创建&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Page_Load&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，始终都会调用页基类的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;OnLoad&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法。但是，如果使用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;override&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;关键字（在&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;Visual Basic&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;中为&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;Overrides&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;）重写页的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;OnLoad&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，则必须显式调用基方法。例如，如果在页中重写&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;OnLoad&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法，则必须调用&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;base.Load&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;（在&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;Visual Basic&amp;nbsp;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;中为&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;span style="line-height: 18px; "&gt;MyBase.Load&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;）以运行基实现&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;以上就是本人的理解和总结，比较简单，可以说只有的理解了简单&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Control&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类和&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类的通用生命周期，以后才可以分析复杂的问题，比如动态创建控件时的数据丢失问题等。再比如目前有不少人喜欢在开发&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Web&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;时候，比较喜欢直接让新建的&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;页面继承自&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类，在这个继承来里面来写一些实现用户身份验证功能，但是如果对页面的生命周期比较了解后，可以这样来做，首先写个继承自&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;Page&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;类的类，在这个类里面根据需要来重写&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;abstract&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;方法和写一些通用的用户身份验证方法，之后让自己的页面后台代码类来实现这个类，从而达到通用的效果。这样做对代码复用性的提高，大家觉得是否有帮助呢？&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;以上拙见，如有错误之处，请帮忙指教。&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; font-size: 9pt; "&gt;参考资料&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;1.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&amp;nbsp;&lt;a href="http://msdn.microsoft.com/zh-cn/library/ms178472(VS.80).aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;MSDN&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;文档&lt;/span&gt;&lt;/span&gt;ASP.NET&amp;nbsp;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;页生命周期概述&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;span style="line-height: 21px; "&gt;&lt;span style="line-height: 21px; "&gt;&lt;span style="line-height: 21px; "&gt;&lt;span style="line-height: 21px; font-family: 'Times New Roman'; "&gt;&lt;span style="line-height: 19px; font-size: small; "&gt;2.&lt;/span&gt;&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 21px; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://blog.csdn.net/ChengKing/archive/2009/11/12/4803816.aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;《庖丁解牛：纵向切入&lt;/span&gt;&lt;/span&gt;ASP.NET 3.5&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;控件和组件开发技术》&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-align: left; text-indent: -18pt; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;3.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://blog.csdn.net/cloudgamer/archive/2007/07/19/1698338.aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;《&lt;/span&gt;&lt;/span&gt;Programming ASP.NET&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;》学习笔记（控件）&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-indent: -18pt; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;4.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://blog.csdn.net/SnowQuery/archive/2008/11/14/3289716.aspx" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: windowtext; "&gt;SnowQuery&lt;/span&gt;&lt;span style="line-height: 18px; font-family: 新宋体; color: windowtext; "&gt;&lt;span style="line-height: 18px; "&gt;的专栏&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 18pt; text-indent: -18pt; "&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;span style="line-height: 18px; "&gt;5.&lt;span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height: 18px; font-family: Century; font-size: 9pt; "&gt;&lt;a href="http://hi.baidu.com/nirvanan/blog/item/1069ce12bb261f2bdc540130.html" style="text-decoration: none; color: #006bad; "&gt;&lt;span style="line-height: 18px; color: #000000; "&gt;&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;深入理解&lt;/span&gt;&lt;/span&gt;Asp.net&lt;span style="line-height: 18px; font-family: 新宋体; "&gt;&lt;span style="line-height: 18px; "&gt;动态控件&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/chy8219/aggbug/2036028.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/chy8219/archive/2011/05/04/2036028.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2011/01/19/1938996.html</id><title type="text">WCF中的Dispose[转]</title><summary type="text">在我翻译的InfoQ新闻《WCF的问题和Using语句块》中提到了释放客户端资源（其中包括端口、通道）和关闭连接的问题。新闻并没有很深入地讨论，所以我想再补充一些内容。毫无疑问，在.NET Framework中，一个资源（尤其是非托管资源）通常都需要实现IDisposable接口。一旦实现了该接口，我们就可以使用using语句来管理资源，这是最便捷的方式。但是，一旦在using语句中抛出了异常，就可能不会正确完成资源的回收，尤其是连接，很可能会一直打开，既占用了通道和端口，还可能出现资源的浪费，从而影响系统的性能和稳定性。微软推荐的最佳实践是抛弃using语句，转而利用try/catch(/f</summary><published>2011-01-19T03:43:00Z</published><updated>2011-01-19T03:43:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2011/01/19/1938996.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2011/01/19/1938996.html"/><content type="html">&lt;p&gt;在我翻译的InfoQ新闻《&lt;a href="http://www.infoq.com/cn/news/2009/03/WCF-Dispose" target="_blank"&gt;&lt;font color="#0a5d0a"&gt;WCF的问题和Using语句块&lt;/font&gt;&lt;/a&gt;》中提到了释放客户端资源（其中包括端口、通道）和关闭连接的问题。新闻并没有很深入地讨论，所以我想再补充一些内容。&lt;/p&gt;&#xD;
&lt;p&gt;毫无疑问，在.NET Framework中，一个资源（尤其是非托管资源）通常都需要实现IDisposable接口。一旦实现了该接口，我们就可以使用using语句来管理资源，这是最便捷的方式。但是，一旦在using语句中抛出了异常，就可能不会正确完成资源的回收，尤其是连接，很可能会一直打开，既占用了通道和端口，还可能出现资源的浪费，从而影响系统的性能和稳定性。&lt;/p&gt;&#xD;
&lt;p&gt;微软推荐的最佳实践是抛弃using语句，转而利用try/catch(/finally)语句。它要求在try语句中调用Close()方法，而在catch中调用Abort()方法。在新闻中已经说明了Close()与Abort()方法的区别，即后者可以强制地关闭客户端，包括关闭客户端连接，释放资源。由于Close()方法可能会抛出CommunicationException和TimeoutException异常，通常的客户端代码应该是这样：&lt;/p&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237); font-family: '[object HTMLOptionElement]', 'Consolas', 'Lucida Console', 'Courier New'" &gt;var myClient = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; MyClient();&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;try&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,128,0)"&gt;//其他代码&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myClient.Close();&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (CommunicationException)&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myClient.Abort();&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (TimeoutException)&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myClient.Abort();&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (Exception)&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myClient.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;throw&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;/div&gt;&#xD;
&lt;p&gt;在最后增加对Exception异常的捕获很有必要，因为我们不知道Close()方法会否抛出某些不可预知的异常，例如OutOfMemoryException等。新闻中提到Steve Smith的方法其实就是对这段冗长代码的封装，封装方式是采用扩展方法，扩展的类型为ICommunicationObject。这是因为所有的客户端对象都实现了ICommunicationObject接口。以下是Steve Smith的扩展方法代码：&lt;/p&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237); font-family: '[object HTMLOptionElement]', 'Consolas', 'Lucida Console', 'Courier New'" &gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Extensions&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; CloseConnection(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt; ICommunicationObject myServiceClient)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (myServiceClient.State != CommunicationState.Opened)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;try&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myServiceClient.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (CommunicationException ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print(ex.ToString());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myServiceClient.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (TimeoutException ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print(ex.ToString());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myServiceClient.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print(ex.ToString());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myServiceClient.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;throw&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;/div&gt;&#xD;
&lt;p&gt;利用该扩展方法，在本应调用Close()方法的地方，代替为CloseConnection()方法，就可以避免写冗长的catch代码。而使用Lambda表达式的方式可以说是独辟蹊径，使用起来与using语法大致接近。实现方法是定义一个静态方法，并接受一个ICommunicationObject对象与Action委托：&lt;/p&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237)" id="codee_html"&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237); font-family: '[object HTMLOptionElement]', 'Consolas', 'Lucida Console', 'Courier New'" &gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;Util&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Using&amp;lt;T&amp;gt;(T client, Action action)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where T : ICommunicationObject&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;try&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action(client);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (CommunicationException)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (TimeoutException)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (Exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;throw&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p&gt;使用时，可以将原本的客户端代码作为Action委托的Lambda表达式传递给Using方法中：&lt;/p&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237)" id="codee_html"&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237); font-family: '[object HTMLOptionElement]', 'Consolas', 'Lucida Console', 'Courier New'" &gt;Util.Using(&lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; MyClient(), client =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; client.SomeWCFOperation();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,128,0)"&gt;//其他代码;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;);&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p&gt;还有一种方法是定义一个自己的ChannelFactory，让其实现IDisposable接口，并作为ChannelFactory的Wrapper类。在该类中定义Close()和Dispose()方法时，考虑到异常抛出的情况，并在异常抛出时调用Abort()方法。这样我们就可以在using中使用自定义的ChannelFactory类。例如：&lt;/p&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237)" id="codee_html"&gt;&#xD;
&lt;div style="background-color: rgb(249,247,237); font-family: '[object HTMLOptionElement]', 'Consolas', 'Lucida Console', 'Courier New'" &gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43,145,175)"&gt;MyChannelFactory&lt;/span&gt;:IDisposable&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; ChannelFactory m_innerFactory;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; MyChannelFactory(ChannelFactory factory)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_innerFactory = factory;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~MyChannelFactory()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispose(&lt;span style="color: rgb(0,0,255)"&gt;false&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Close()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Close(TimeSpan.FromSeconds(10));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Close(TimeSpan span)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (m_innerFactory != &lt;span style="color: rgb(0,0,255)"&gt;null&lt;/span&gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (m_innerFactory.State != CommunicationState.Opened)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;try&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_innerFactory.Close(span);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (CommunicationException)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_innerFactory.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (TimeOutException)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_innerFactory.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;catch&lt;/span&gt; (Exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_innerFactory.Abort();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;throw&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; Dispose(booling disposing)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;if&lt;/span&gt; (disposing)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;void&lt;/span&gt; IDisposable.Dispose()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;{&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispose(&lt;span style="color: rgb(0,0,255)"&gt;true&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GC.SuppressFinalize(&lt;span style="color: rgb(0,0,255)"&gt;this&lt;/span&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0,0,255)"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p&gt;其实，新闻中提到采用代理模式的方式与此实现相同。总之，万变不离其宗，所有替代方案的设计本质都是对冗长的try/catch/finally的一次包装，从而有效地实现重用，保证系统的安全、性能与稳定性。&lt;/p&gt;&lt;img src="http://www.cnblogs.com/chy8219/aggbug/1938996.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/chy8219/archive/2011/01/19/1938996.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2011/01/12/1933857.html</id><title type="text">面向程序员的数据库访问性能优化法则</title><summary type="text">特别说明： 1、本文只是面对数据库应用开发的程序员，不适合专业DBA，DBA在数据库性能优化方面需要了解更多的知识； 2、本文许多示例及概念是基于Oracle数据库描述，对于其它关系型数据库也可以参考，但许多观点不适合于KV数据库或内存数据库或者是基于SSD技术的数据库； 3、本文未深入数据库优化中最核心的执行计划分析技术。  读者对像： 开发人员：如果你是做数据库开发，那本文的内容非常适合，因为本文是从程序员的角度来谈数据库性能优化。 架构师：如果你已经是数据库应用的架构师，那本文的知识你应该清楚90%，否则你可能是一个喜欢折腾的架构师。 DBA（数据库管理员）：大型数据库优化的知识非常复杂</summary><published>2011-01-12T06:27:00Z</published><updated>2011-01-12T06:27:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2011/01/12/1933857.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2011/01/12/1933857.html"/><content type="html">&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;特别说明：&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;本文只是面对数据库应用开发的程序员，不适合专业&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在数据库性能优化方面需要了解更多的知识；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;2、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;本文许多示例及概念是基于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库描述，对于其它关系型数据库也可以参考，但许多观点不适合于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;KV&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库或内存数据库或者是基于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SSD&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;技术的数据库；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;3、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;本文未深入数据库优化中最核心的执行计划分析技术。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;读者对像：&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;开发人员：&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;如果你是做数据库开发，那本文的内容非常适合，因为本文是从程序员的角度来谈数据库性能优化。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;架构师：&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;如果你已经是数据库应用的架构师，那本文的知识你应该清楚&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;90%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，否则你可能是一个喜欢折腾的架构师。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;（数据库管理员）：&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;大型数据库优化的知识非常复杂，本文只是从程序员的角度来谈性能优化，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;除了需要了解这些知识外，还需要深入数据库的内部体系架构来解决问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.5pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: x-large;"&gt;&lt;strong&gt;引言&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;在网上有很多文章介绍数据库优化知识，但是大部份文章只是对某个一个方面进行说明，而对于我们程序员来说这种介绍并不能很好的掌握优化知识，因为很多介绍只是对一些特定的场景优化的，所以反而有时会产生误导或让程序员感觉不明白其中的奥妙而对数据库优化感觉很神秘。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;很多程序员总是问如何学习数据库优化，有没有好的教材之类的问题。在书店也看到了许多数据库优化的专业书籍，但是感觉更多是面向&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;或者是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;PL/SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开 发方面的知识，个人感觉不太适合普通程序员。而要想做到数据库优化的高手，不是花几周，几个月就能达到的，这并不是因为数据库优化有多高深，而是因为要做 好优化一方面需要有非常好的技术功底，对操作系统、存储硬件网络、数据库原理等方面有比较扎实的基础知识，另一方面是需要花大量时间对特定的数据库进行实 践测试与总结。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;作为一个程序员，我们也许不清楚线上正式的服务器硬件配置，我们不可能像&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;那样专业的对数据库进行各种实践测试与总结，但我们都应该非常了解我们&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的业务逻辑，我们清楚&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中访问表及字段的数据情况，我们其实只关心我们的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;是否能尽快返回结果。那程序员如何利用已知的知识进行数据库优化？如何能快速定位&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;性能问题并找到正确的优化方向？&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;面对这些问题，笔者总结了一些面向程序员的基本优化法则，本文将结合实例来坦述数据库开发的优化知识。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: x-large;"&gt;一、数据库访问优化法则简介&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;要正确的优化&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，我们需要快速定位能性的瓶颈点，也就是说快速找到我们&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;主要的开销在哪里？而大多数情况性能最慢的设备会是瓶颈点，如下载时网络速度可能会是瓶颈点，本地复制文件时硬盘可能会是瓶颈点，为什么这些一般的工作我们能快速确认瓶颈点呢，因为我们对这些慢速设备的性能数据有一些基本的认识，如网络带宽是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2Mbps&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，硬盘是每分钟&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;7200&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;转等等。因此，为了快速找到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的性能瓶颈点，我们也需要了解我们计算机系统的硬件基本性能指标，下图展示的当前主流计算机性能指标数据。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636622rnbL.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;从图上可以看到基本上每种设备都有两个指标：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;延时（响应时间）：表示硬件的突发处理能力；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;带宽（吞吐量）：代表硬件持续处理能力。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;从上图可以看出，计算机系统硬件性能从高到代依次为：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&amp;#8212;&amp;#8212;&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Cache(L1-L2-L3)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&amp;#8212;&amp;#8212;内存&amp;#8212;&amp;#8212;&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SSD&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;硬盘&amp;#8212;&amp;#8212;网络&amp;#8212;&amp;#8212;硬盘&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;由于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SSD&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;硬盘还处于快速发展阶段，所以本文的内容不涉及&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SSD&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;相关应用系统。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;根据数据库知识，我们可以列出每种硬件主要的工作内容：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及内存：缓存数据访问、比较、排序、事务检测、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;解析、函数或逻辑运算；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;网络：结果数据传输、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;请求、远程数据库访问（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;dblink&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;）；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;硬盘：数据访问、数据写入、日志记录、大数据量排序、大表连接。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;根据当前计算机硬件的基本性能指标及其在数据库中主要操作内容，可以整理出如下图所示的性能基本优化法则：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_12916372042dJ3.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;这个优化法则归纳为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个层次：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;减少数据访问（减少磁盘访问）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;2、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;返回更少数据（减少网络传输或磁盘访问）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;3、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;减少交互次数（减少网络传输）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;4、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;减少服务器&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销（减少&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及内存开销）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 18pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;5、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;利用更多资源（增加资源）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;由于每一层优化法则都是解决其对应硬件的性能问题，所以带来的性能提升比例也不一样。传统数据库系统设计是也是尽可能对低速设备提供优化方法，因此针对低速设备问题的可优化手段也更多，优化成本也更低。我们任何一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的性能优化都应该按这个规则由上到下来诊断问题并提出解决方案，而不应该首先想到的是增加资源解决问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;以下是每个优化法则层级对应优化效果及成本经验参考：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 142pt; border: 1pt solid black;" valign="top" width="189"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;优化法则&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;性能提升效果&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;优化成本&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 142pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;减少数据访问&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1~1000&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;低&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 142pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;返回更少数据&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1~100&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;低&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 142pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;减少交互次数&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1~20&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;低&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 142pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;减少服务器&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;1~5&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;低&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 142pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;利用更多资源&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;@~10&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 75.75pt;" valign="top" width="101"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;高&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;接下来，我们针对&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;种优化法则列举常用的优化手段并结合实例分析。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: x-large;"&gt;&lt;span style="font-family: 宋体;"&gt;二、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: x-large;"&gt;数据库两个基本概念&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;数据块&lt;/span&gt;&lt;span style="font-family: Cambria;"&gt;(Block)&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据块是数据库中数据在磁盘中存储的最小单位，也是一次&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;访问的最小单位，一个数据块通常可以存储多条记录，数据块大小是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在创建数据库或表空间时指定，可指定为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;4K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;8K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;16K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;或&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;32K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字节。下图是一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库典型的物理结构，一个数据库可以包括多个数据文件，一个数据文件内又包含多个数据块；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636632fz7h.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;ROWID&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;是每条记录在数据库中的唯一标识，通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;可以直接定位记录到对应的文件号及数据块位置。&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;内容包括文件号、对像号、数据块号、记录槽号，如下图所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: x-large;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636638QCqG.gif" alt="" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: x-large;"&gt;三、数据库访问优化法则详解&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、减少数据访问&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;1.1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、创建并使用正确的索引&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据库索引的原理非常简单，但在复杂的表中真正能正确使用索引的人很少，即使是专业的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;也不一定能完全做到最优。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引会大大增加表记录的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DML(INSERT,UPDATE,DELETE)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销，正确的索引可以让性能提升&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;倍以上，不合理的索引也可能会让性能下降&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;倍，因此在一个表中创建什么样的索引需要平衡各种业务需求。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;索引常见问题：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引有哪些种类？&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;常见的索引有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引、位图索引、全文索引，位图索引一般用于数据仓库应用，全文索引由于使用较少，这里不深入介绍。&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引包括很多扩展类型，如组合索引、反向索引、函数索引等等，以下是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引的简单介绍：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引也称为平衡树索引&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(Balance Tree)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，它是一种按字段排好序的树形目录结构，主要用于提升查询性能和唯一约束支持。&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引的内容包括根节点、分支节点、叶子节点。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;叶子节点内容：&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;索引字段内容&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表记录&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;根节点，分支节点内容：&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;当一个数据块中不能放下所有索引字段数据时，就会形成树形的根节点或分支节点，根节点与分支节点保存了索引树的顺序及各层级间的引用关系。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;一个普通的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;BTREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引结构示意图如下所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636647TTAA.gif" alt="" /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;如果我们把一个表的内容认为是一本字典，那索引就相当于字典的目录，如下图所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;nbsp;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_12916366512rkn.gif" alt="" /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_129163667068Da.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;图中是一个字典按部首&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;笔划数的目录，相当于给字典建了一个按部首&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;笔划的组合索引。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;一个表中可以建多个索引，就如一本字典可以建多个目录一样（按拼音、笔划、部首等等）。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;一个索引也可以由多个字段组成，称为组合索引，如上图就是一个按部首&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;笔划的组合目录。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;什么条件会使用索引？&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;当字段上建有索引时，通常以下情况会使用索引：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN = ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN &amp;gt; ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN &amp;gt;= ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN &amp;lt; ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN &amp;lt;= ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN between ? and ?&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN in (?,?,...,?)&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;INDEX_COLUMN like ?||'%'&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（后导模糊查询）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;T1. INDEX_COLUMN=T2. COLUMN1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（两个表通过索引字段关联）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;什么条件不会使用索引？&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt; border: 1pt solid black;" valign="top" width="234"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;查询条件&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;不能使用索引原因&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN &amp;lt;&amp;gt; ?&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN not in (?,?,...,?)&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;不等于操作不能使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;function(INDEX_COLUMN) = ?&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN + 1 = ?&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN || 'a' = ?&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;经过普通运算或函数运算后的索引字段不能使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN like '%'||?&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN like '%'||?||'%'&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;含前导模糊查询的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Like&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;语法不能使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;INDEX_COLUMN is null&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引里不保存字段为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;NULL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;值记录，因此&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IS NULL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;不能使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;NUMBER_INDEX_COLUMN='12345'&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;CHAR_INDEX_COLUMN=12345&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在做数值比较时需要将两边的数据转换成同一种数据类型，如果两边数据类型不同时会对字段值隐式转换，相当于加了一层函数处理，所以不能使用索引。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 175.5pt;" valign="top" width="234"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;a.INDEX_COLUMN=a.COLUMN_1&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 209.75pt;" valign="top" width="280"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;给索引查询的值应是已知数据，不能是未知字段值。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 151.55pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 385.25pt; height: 151.55pt;" colspan="2" valign="top" width="514"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;注：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;经过函数运算字段的字段要使用可以使用函数索引，这种需求建议与&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;沟通。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;有时候我们会使用多个字段的组合索引，如果查询条件中第一个字段不能使用索引，那整个查询也不能使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如：我们&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;company&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表建了一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;id+name&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的组合索引，以下&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;是不能使用索引的&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Select * from company where name=?&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Oracle9i&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;后引入了一种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;index skip scan&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的索引方式来解决类似的问题，但是通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;index skip scan&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;提高性能的条件比较特殊，使用不好反而性能会更差。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;我们一般在什么字段上建索引？&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;这是一个非常复杂的话题，需要对业务及数据充分分析后再能得出结果。主键及外键通常都要有索引，其它需要建索引的字段应满足以下条件：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、字段出现在查询条件中，并且查询条件可以使用索引；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、语句执行频率高，一天会有几千次以上；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、通过字段条件可筛选的记录集很小，&lt;strong&gt;那数据筛选比例是多少才适合？&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;这个没有固定值，需要根据表数据量来评估，以下是经验公式，可用于快速评估：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;小表&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;记录数小于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10000&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;行的表&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;：筛选比例&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;lt;10%&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;；&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;大表：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;筛选返回记录数&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&amp;lt;(&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;表总记录数&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;*&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;单条记录长度&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)/10000/16&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;单条记录长度&amp;#8776;字段平均内容长度之和&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;+&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;字段数&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;*2&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以下是一些字段是否需要建&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B-TREE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引的经验分类：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 60.5pt; border: 1pt solid black;" valign="top" width="81"&gt; &lt;p&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;字段类型&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;常见字段名&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 60.5pt;" rowspan="3" valign="top" width="81"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;需要建索引的字段&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;主键&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ID,PK&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;外键&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;PRODUCT_ID,COMPANY_ID,MEMBER_ID,ORDER_ID,TRADE_ID,PAY_ID&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;有对像或身份标识意义字段&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;HASH_CODE,USERNAME,IDCARD_NO,EMAIL,TEL_NO,IM_NO&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 60.5pt;" rowspan="8" valign="top" width="81"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引慎用字段&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;,&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;需要进行数据分布及使用场景详细评估&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;日期&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;GMT_CREATE,GMT_MODIFIED&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;年月&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;YEAR,MONTH&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;状态标志&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;PRODUCT_STATUS,ORDER_STATUS,IS_DELETE,VIP_FLAG&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;类型&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ORDER_TYPE,IMAGE_TYPE,GENDER,CURRENCY_TYPE&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;区域&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;COUNTRY,PROVINCE,CITY&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;操作人员&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;CREATOR,AUDITOR&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;数值&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;LEVEL,AMOUNT,SCORE&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;长字符&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ADDRESS,COMPANY_NAME,SUMMARY,SUBJECT&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 60.5pt;" rowspan="2" valign="top" width="81"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;不适合建索引的字段&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;描述备注&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;DESCRIPTION,REMARK,MEMO,DETAIL&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 58.65pt;" valign="top" width="78"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;大字段&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 306.95pt;" valign="top" width="409"&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;FILE_CONTENT,EMAIL_CONTENT&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;如何知道&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;是否使用了正确的索引？&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;简单&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;可以根据索引使用语法规则判断，复杂的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;不好办，判断&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的响应时间是一种策略，但是这会受到数据量、主机负载及缓存等因素的影响，有时数据全在缓存里，可能全表访问的时间比索引访问时间还少。要准确知道索引是否正确使用，需要到数据库中查看&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;真实的执行计划，这个话题比较复杂，详见&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划专题介绍。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;索引对&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DML(INSERT,UPDATE,DELETE)&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;附加的开销有多少？&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;这个没有固定的比例，与每个表记录的大小及索引字段大小密切相关，以下是一个普通表测试数据，仅供参考：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt; margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引对于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Insert&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;性能降低&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;56%&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt; margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引对于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Update&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;性能降低&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;47%&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt; margin: 0cm 0cm 0pt 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;索引对于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Delete&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;性能降低&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;29%&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;因此对于写&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;压力比较大的系统，表的索引需要仔细评估必要性，另外索引也会占用一定的存储空间。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;1.2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、只通过索引访问数据&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;有些时候，我们只是访问表中的几个字段，并且字段内容较少，我们可以为这几个字段单独建立一个组合索引，这样就可以直接只通过访问索引就能得到数据，一般索引占用的磁盘空间比表小很多，所以这种方式可以大大减少磁盘&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;select id,name from company where type='2';&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果这个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;经常使用，我们可以在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;type,id,name&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;上创建组合索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;create index my_comb_index on company(type,id,name);&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;有了这个组合索引后，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;就可以直接通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;my_comb_index&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引返回数据，不需要访问&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;company&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;还是拿字典举例：有一个需求，需要查询一本汉语字典中所有汉字的个数，如果我们的字典没有目录索引，那我们只能从字典内容里一个一个字计数，最后返回结果。如果我们有一个拼音目录，那就可以只访问拼音目录的汉字进行计数。如果一本字典有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;页，拼音目录有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;页，那我们的数据访问成本相当于全表访问的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;50&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分之一。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;切记，性能优化是无止境的，当性能可以满足需求时即可，不要过度优化。&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;在实际数据库中我们不可能把每个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;请求的字段都建在索引里，所以这种只通过索引访问数据的方法一般只用于核心应用，也就是那种对核心表访问量最高且查询字段数据量很少的查询。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;1.3&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、优化&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划是关系型数据库最核心的技术之一，它表示&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行时的数据访问算法。由于业务需求越来越复杂，表数据量也越来越大，程序员越来越懒惰，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;也需要支持非常复杂的业务逻辑，但&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的性能还需要提高，因此，优秀的关系型数据库除了需要支持复杂的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;语法及更多函数外，还需要有一套优秀的算法库来提高&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;目前&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ORACLE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划的算法约&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;300&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;种，而且一直在增加，所以&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划是一个非常复杂的课题，一个普通&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;能掌握&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;50&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;种就很不错了，就算是资深&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;也不可能把每个执行计划的算法描述清楚。虽然有这么多种算法，但并不表示我们无法优化执行计划，因为我们常用的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划算法也就十几个，如果一个程序员能把这十几个算法搞清楚，那就掌握了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;80%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划调优知识。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;由于篇幅的原因，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划需要专题介绍，在这里就不多说了。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、返回更少的数据&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;2.1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、数据分页处理&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;一般数据分页方式有：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: Cambria;"&gt;2.1.1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、客户端&lt;/span&gt;&lt;span style="font-family: Cambria;"&gt;(&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;应用程序或浏览器&lt;/span&gt;&lt;span style="font-family: Cambria;"&gt;)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分页&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;将数据从应用服务器全部下载到本地应用程序或浏览器，在应用程序或浏览器内部通过本地代码进行分页处理&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;优点：编码简单，减少客户端与应用服务器网络交互次数&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;缺点：首次交互时间长，占用客户端内存&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;适应场景：客户端与应用服务器网络延时较大，但要求后续操作流畅，如手机&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;GPRS&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，超远程访问（跨国）等等。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: Cambria;"&gt;2.1.2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、应用服务器分页&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;将数据从数据库服务器全部下载到应用服务器，在应用服务器内部再进行数据筛选。以下是一个应用服务器端&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Java&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;程序分页的示例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;List list=executeQuery(&amp;#8220;select * from employee order by id&amp;#8221;);&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Int count= list.size();&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;List subList= list.subList(10, 20);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;优点：编码简单，只需要一次&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;交互，总数据与分页数据差不多时性能较好。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;缺点：总数据量较多时性能较差。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;适应场景：数据库系统不支持分页处理，数据量较小并且可控。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: Cambria;"&gt;2.1.3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、数据库&lt;/span&gt;&lt;span style="font-family: Cambria;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分页&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;采用数据库&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分页需要两次&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;完成&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;计算总数量&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;返回分页后的数据&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;优点：性能好&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;缺点：编码复杂，各种数据库语法不同，需要两次&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;交互。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库一般采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;rownum&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;来进行分页，常用分页语法有如下两种：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;直接通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;rownum&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;分页：&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select * from (&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*,rownum rn from &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select * from product a where company_id=? order by status) a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where rownum&amp;lt;=20) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;where rn&amp;gt;10;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据访问开销&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;=&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引全部记录结果对应的表数据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;rowid&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;分页语法&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;优化原理是通过纯索引找出分页记录的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，再通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;回表返回数据，要求内层查询和排序字段全在索引里。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;create index myindex on product(company_id,status);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select b.* from (&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from (&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*,rownum rn from &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select rowid rid,status from product a where company_id=? order by status) a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where rownum&amp;lt;=20) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where rn&amp;gt;10) a, product b&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;where a.rid=b.rowid;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据访问开销&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;=&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO+&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;索引分页结果对应的表数据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;实例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;一个公司产品有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条记录，要分页取其中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个产品，假设访问公司索引需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;50&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条记录需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个表数据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;那么按第一种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWNUM&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分页写法，需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;550(50+1000/2)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，按第二种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ROWID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;分页写法，只需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;60&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO(50+20/2);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;2.2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、只返回需要的字段&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;通过去除不必要的返回字段可以提高性能，例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;调整前：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;select * from product where company_id=?;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;调整后：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;select id,name from product where company_id=?;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;优点：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、减少数据在网络上传输开销&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、减少服务器数据处理开销&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、减少客户端内存占用&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;4&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、字段变更时提前发现问题，减少程序&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;BUG&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、如果访问的所有字段刚好在一个索引里面，则可以使用纯索引访问提高性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;缺点：增加编码工作量&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;由于会增加一些编码工作量，所以一般需求通过开发规范来要求程序员这么做，否则等项目上线后再整改工作量更大。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;如 果你的查询表中有大字段或内容较多的字段，如备注信息、文件内容等等，那在查询表时一定要注意这方面的问题，否则可能会带来严重的性能问题。如果表经常要 查询并且请求大内容字段的概率很低，我们可以采用分表处理，将一个大表分拆成两个一对一的关系表，将不常用的大内容字段放在一张单独的表中。如一张存储上 传文件的表：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;T_FILE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID,FILE_NAME,FILE_SIZE,FILE_TYPE,FILE_CONTENT&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;我们可以分拆成两张一对一的关系表：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;T_FILE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID,FILE_NAME,FILE_SIZE,FILE_TYPE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;T_FILECONTENT&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID, FILE_CONTENT&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;通过这种分拆，可以大大提少&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;T_FILE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表的单条记录及总大小，这样在查询&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;T_FILE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;时性能会更好，当需要查询&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;FILE_CONTENT&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字段内容时再访问&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;T_FILECONTENT&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、减少交互次数&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.1&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、&lt;span style="font-family: Calibri;"&gt;batch DML&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据库访问框架一般都提供了批量提交的接口，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;jdbc&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;支持&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;batch&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的提交处理方法，当你一次性要往一个表中插入&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万条数据时，如果采用普通的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;executeUpdate&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;处理，那么和服务器交互次数为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万次，按每秒钟可以向数据库服务器提交&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;次估算，要完成所有工作需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;秒。如果采用批量提交模式，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条提交一次，那么和服务器交互次数为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万次，交互次数大大减少。采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;batch&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;操作一般不会减少很多数据库服务器的物理&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，但是会大大减少客户端与服务端的交互次数，从而减少了多次发起的网络延时开销，同时也会降低数据库的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;假设要向一个普通表插入&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万数据，每条记录大小为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1K&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字节，表上没有任何索引，客户端与数据库服务器网络是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100Mbps&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，以下是根据现在一般计算机能力估算的各种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;batch&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;大小性能对比值：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt; border: 1pt solid black;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;　单位：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black;"&gt;ms&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;No batch&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;Batch=10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;Batch=100&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;Batch=1000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;Batch=10000&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;服务器事务处理时间&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;服务器&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体; color: black;"&gt;处理时间&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.02&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;20&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;200&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;网络交互发起时间&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;网络数据传输时间&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.01&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;100&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;小计&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.23&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;0.5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" valign="top" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;3.2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" valign="top" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;30.2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" valign="top" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;300.2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 118.8pt;" valign="top" width="158"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体; color: black;"&gt;平均每条记录处理时间&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black; font-size: 11pt;"&gt;0.23&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black; font-size: 11pt;"&gt;0.05&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 2cm;" width="76"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black; font-size: 11pt;"&gt;0.032&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 63.8pt;" width="85"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black; font-size: 11pt;"&gt;0.0302&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 73.4pt;" width="98"&gt; &lt;p align="right"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="color: black; font-size: 11pt;"&gt;0.03002&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;从上可以看出，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Insert&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;操作加大&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Batch&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;可以对性能提高近&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;8&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;倍性能，一般根据主键的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Update&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;或&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Delete&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;操作也可能提高&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2-3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;倍性能，但不如&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Insert&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;明显，因为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Update&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Delete&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;操作可能有比较大的开销在物理&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;访问。以上仅是理论计算值，实际情况需要根据具体环境测量。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.2&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、&lt;span style="font-family: Calibri;"&gt;In List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;很多时候我们需要按一些&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;查询数据库记录，我们可以采用一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;一个请求发给数据库，如下所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;for :var in ids[] do begin&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;select * from mytable where id=:var;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;end;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;我们也可以做一个小的优化，&lt;/span&gt; &lt;span style="font-family: 宋体;"&gt;如下所示，用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID INLIST&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的这种方式写&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 10.5pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select * from mytable where id in(:id1,id2,...,idn);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;通过这样处理可以大大减少&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;请求的数量，从而提高性能。那如果有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，那是不是全部放在一条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里处理呢？答案肯定是否定的。首先大部份数据库都会有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;长度和&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里个数的限制，如&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;ORACLE&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;里就不允许超过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;个值&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;另外当前数据库一般都是采用基于成本的优化规则，当&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数量达到一定值时有可能改变&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划，从索引访问变成全表访问，这将使性能急剧变化。随着&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的里面的值个数增加，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的执行计划会更复杂，占用的内存将会变大，这将会增加服务器&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及内存成本。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;评估在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里面一次放多少个值还需要考虑应用服务器本地内存的开销，有并发访问时要计算本地数据使用周期内的并发上限，否则可能会导致内存溢出。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;综合考虑，一般&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IN&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里面的值个数超过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个以后性能基本没什么太大变化，也特别说明不要超过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，超过后可能会引起执行计划的不稳定性及增加数据库&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及内存成本，这个需要专业&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;评估。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.3&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、设置&lt;span style="font-family: Calibri;"&gt;Fetch Size&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;当我们采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;select&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;从数据库查询数据时，数据默认并不是一条一条返回给客户端的，也不是一次全部返回客户端的，而是根据客户端&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetch_size&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;参数处理，每次只返回&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetch_size&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条记录，当客户端游标遍历到尾部时再从服务端取数据，直到最后全部传送完成。所以如果我们要从服务端一次取大量数据时，可以加大&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetch_size&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，这样可以减少结果数据传输的交互次数及服务器数据准备时间，提高性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以下是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;jdbc&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;测试的代码，采用本地数据库，表缓存在数据库&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CACHE&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中，因此没有网络连接及磁盘&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销，客户端只遍历游标，不做任何处理，这样更能体现&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetch&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;参数的影响：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;String vsql ="select * from t_employee";&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;PreparedStatement pstmt = conn.prepareStatement(vsql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;pstmt.setFetchSize(1000);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ResultSet rs = pstmt.executeQuery(vsql);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;int cnt = rs.getMetaData().getColumnCount();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;Object o;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;while (rs.next()) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 1; i &amp;lt;= cnt; i++) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o = rs.getObject(i);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;测试示例中的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;employee&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条记录，每条记录平均长度&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;135&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字节&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以下是测试结果，对每种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;测试&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;次再取平均值：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="margin: auto auto auto 5.15pt; width: 322px; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt; border: 1pt solid windowtext;" width="128"&gt; &lt;p align="left"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;fetchsize&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="left"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;&amp;nbsp;elapse_time&lt;/span&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;（s）&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;1&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;20.516&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;11.34&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;4&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;6.894&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;8&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;4.65&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;16&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;3.584&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;32&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.865&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;64&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.656&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体; color: red; font-size: 11pt;"&gt;128&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体; color: red; font-size: 11pt;"&gt;2.44&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;256&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.765&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;512&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;3.075&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;1024&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.862&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2048&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.722&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;4096&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.681&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr style="height: 13.5pt;"&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 windowtext windowtext; padding: 0cm 5.4pt; background-color: transparent; width: 96pt; height: 13.5pt;" width="128"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;8192&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 windowtext windowtext #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 145.25pt; height: 13.5pt;" width="194"&gt; &lt;p align="right"&gt;&lt;span style="font-family: 宋体; color: black; font-size: 11pt;"&gt;2.715&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636674fm6c.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Oracle jdbc fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;默认值为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，由上测试可以看出&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;对性能影响还是比较大的，但是当&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;大于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;时就基本上没有影响了。&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;并不会存在一个最优的固定值，因为整体性能与记录集大小及硬件平台有关。根据测试结果建议当一次性要取大量数据时这个值设置为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;左右，不要小于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;40&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。注意，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;不能设置太大，如果一次取出的数据大于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的内存会导致内存溢出，所以建议不要超过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，太大了也没什么性能提高，反而可能会增加内存溢出的危险。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;注：图中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;128&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;以后会有一些小的波动，这并不是测试误差，而是由于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;填充到具体对像时间不同的原因，由于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;已经到本地内存里了，所以估计是由于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;L1,L2 Cache&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;命中率变化造成，由于变化不大，所以笔者也未深入分析原因。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;iBatis&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SqlMapping&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;配置文件可以对每个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;语句指定&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;fetchsize&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;大小，如下所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;lt;select id="getAllProduct" resultMap="HashMap"&lt;strong&gt;&lt;span style="color: red;"&gt; fetchSize="1000"&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select * from employee&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&amp;lt;/select&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.4&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、使用存储过程&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;大型数据库一般都支持存储过程，合理的利用存储过程也可以提高系统性能。如你有一个业务需要将&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;A&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表的数据做一些加工然后更新到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表中，但是又不可能一条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;完成，这时你需要如下&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;步操作：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;a&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;：将&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;A&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表数据全部取出到客户端；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;b&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;：计算出要更新的数据；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;c&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;：将计算结果更新到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;B&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;如果采用存储过程你可以将整个业务逻辑封装在存储过程里，然后在客户端直接调用存储过程处理，这样可以减少网络交互的成本。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;当然，存储过程也并不是十全十美，存储过程有以下缺点：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;a&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、不可移植性，每种数据库的内部编程语法都不太相同，当你的系统需要兼容多种数据库时最好不要用存储过程。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;b&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、学习成本高，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;一般都擅长写存储过程，但并不是每个程序员都能写好存储过程，除非你的团队有较多的开发人员熟悉写存储过程，否则后期系统维护会产生问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;c&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、业务逻辑多处存在，采用存储过程后也就意味着你的系统有一些业务逻辑不是在应用程序里处理，这种架构会增加一些系统维护和调试成本。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;d&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、存储过程和常用应用程序语言不一样，它支持的函数及语法有可能不能满足需求，有些逻辑就只能通过应用程序处理。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;e&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、如果存储过程中有复杂运算的话，会增加一些数据库服务端的处理成本，对于集中式数据库可能会导致系统可扩展性问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;f&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、为了提高性能，数据库会把存储过程代码编译成中间运行代码&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;类似于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;java&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;class&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;文件&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，所以更像静态语言。当存储过程引用的对像&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表、视图等等&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;结构改变后，存储过程需要重新编译才能生效，在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;24*7&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;高并发应用场景，一般都是在线变更结构的，所以在变更的瞬间要同时编译存储过程，这可能会导致数据库瞬间压力上升引起故障&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库就存在这样的问题&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;个人观点：普通业务逻辑尽量不要使用存储过程，定时性的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ETL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;任务或报表统计函数可以根据团队资源情况采用存储过程处理。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、优化业务逻辑&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;要通过优化业务逻辑来提高性能是比较困难的，这需要程序员对所访问的数据及业务流程非常清楚。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;举一个案例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;某移动公司推出优惠套参，活动对像为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;VIP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;会员并且&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2010&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;年&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;月平均话费&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;元以上的客户。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;那我们的检测逻辑为：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select avg(money) as avg_money from bill where phone_no='13988888888' and date between '201001' and '201003';&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select vip_flag from member where phone_no='13988888888';&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;if avg_money&amp;gt;20 and vip_flag=true then&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;begin&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行套参&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;end;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果我们修改业务逻辑为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select avg(money) as&amp;nbsp;avg_money from bill where phone_no='13988888888' and date between '201001' and '201003';&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;if avg_money&amp;gt;20 then&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;begin&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;select vip_flag from member where phone_no='13988888888';&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;if vip_flag=true then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;begin&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行套参&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;end;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;end;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;通过这样可以减少一些判断&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;vip_flag&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的开销，平均话费&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;元以下的用户就不需要再检测是否&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;VIP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;了。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果程序员分析业务，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;VIP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;会员比例为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，平均话费&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;20&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;元以上的用户比例为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;90%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，那我们改成如下：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select vip_flag from member where phone_no='13988888888';&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;if vip_flag=true then&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;begin&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;select avg(money) as avg_money from bill where phone_no='13988888888' and date between '201001' and '201003';&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;if avg_money&amp;gt;20 then&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;begin&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行套参&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;end;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;end;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;这样就只有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;VIP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;会员才会做检测平均话费，最终大大减少了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的交互次数。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;以上只是一个简单的示例，实际的业务总是比这复杂得多，所以一般只是高级程序员更容易做出优化的逻辑，但是我们需要有这样一种成本优化的意识。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;3.6&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、使用&lt;span style="font-family: Calibri;"&gt;ResultSet&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;游标处理记录&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;现在大部分&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Java&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;框架都是通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;jdbc&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;从数据库取出数据，然后装载到一个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;list&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里再处理，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;list&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里可能是业务&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Object&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，也可能是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;hashmap&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;由于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;内存一般都小于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;4G&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，所以不可能一次通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;sql&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;把大量数据装载到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;list&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里。为了完成功能，很多程序员喜欢采用分页的方法处理，如一次从数据库取&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;条记录，通过多次循环搞定，保证不会引起&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM Out of memory&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以下是实现此功能的代码示例，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;t_employee&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;表有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万条记录，设置分页大小为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;d1 = Calendar.getInstance().getTime();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;vsql = "select count(*) cnt from t_employee";&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;pstmt = conn.prepareStatement(vsql);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ResultSet rs = pstmt.executeQuery();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer cnt = 0;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;while (rs.next()) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt = rs.getInt("cnt");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer lastid=0;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer pagesize=1000;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;System.out.println("cnt:" + cnt);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;String vsql = "select count(*) cnt from t_employee";&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;PreparedStatement pstmt = conn.prepareStatement(vsql);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ResultSet rs = pstmt.executeQuery();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer cnt = 0;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;while (rs.next()) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt = rs.getInt("cnt");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer lastid = 0;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Integer pagesize = 1000;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;System.out.println("cnt:" + cnt);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;for (int i = 0; i &amp;lt;= cnt / pagesize; i++) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vsql = "select * from (select * from t_employee where id&amp;gt;? order by id) where rownum&amp;lt;=?";&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pstmt = conn.prepareStatement(vsql);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pstmt.setFetchSize(1000);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pstmt.setInt(1, lastid);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pstmt.setInt(2, pagesize);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs = pstmt.executeQuery();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int col_cnt = rs.getMetaData().getColumnCount();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Object o;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (rs.next()) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j = 1; j &amp;lt;= col_cnt; j++) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o = rs.getObject(j);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastid = rs.getInt("id");&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.close();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pstmt.close();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以上代码实际执行时间为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;6.516&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;秒&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;很多持久层框架为了尽量让程序员使用方便，封装了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;jdbc&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;statement&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行数据返回到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的细节，导致程序员会想采用分页的方式处理问题。实际上如果我们采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;jdbc&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;原始的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;游标处理记录，在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;循环读取的过程中处理记录，这样就可以一次从数据库取出所有记录。显著提高性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;这里需要注意的是，采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;游标处理记录时，应该将游标的打开方式设置为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;FORWARD_READONLY&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;模式&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，否则会把结果缓存在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里，造成&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM Out of memory&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;代码示例：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;String vsql ="select * from t_employee";&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;PreparedStatement pstmt = conn.prepareStatement(vsql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;pstmt.setFetchSize(100);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;ResultSet rs = pstmt.executeQuery(vsql);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;int col_cnt = rs.getMetaData().getColumnCount();&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Object o;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;while (rs.next()) {&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j = 1; j &amp;lt;= col_cnt; j++) {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o = rs.getObject(j);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;调整后的代码实际执行时间为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3.156&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;秒&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;从测试结果可以看出性能提高了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;倍多，如果采用分页模式数据库每次还需发生磁盘&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的话那性能可以提高更多。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;iBatis&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;等持久层框架考虑到会有这种需求，所以也有相应的解决方案，在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;iBatis&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里我们不能采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;queryForList&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的方法，而应用该采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;queryWithRowHandler&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;加回调事件的方式处理，如下所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;MyRowHandler myrh=&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #7f0055; font-size: 10pt;"&gt;new&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt; MyRowHandler();&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;em&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; background: none repeat scroll 0% 0% yellow; color: #0000c0; font-size: 10pt;"&gt;sqlmap&lt;/span&gt;&lt;/em&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;.queryWithRowHandler(&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #2a00ff; font-size: 10pt;"&gt;"getAllEmployee"&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;, myrh);&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #7f0055; font-size: 10pt;"&gt;class&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt; MyRowHandler &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #7f0055; font-size: 10pt;"&gt;implements&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt; RowHandler {&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #7f0055; font-size: 10pt;"&gt;public&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #7f0055; font-size: 10pt;"&gt;void&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt; handleRow(Object o) {&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: #3f7f5f; font-size: 10pt;"&gt;//todo something&lt;/span&gt;&lt;/p&gt; &lt;p align="left"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; color: black; font-size: 10pt;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;iBatis&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;queryWithRowHandler&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;很好的封装了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;遍历的事件处理，效果及性能与&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;resultset&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;遍历一样，也不会产生&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;JVM&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;内存溢出。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;4&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: 宋体;"&gt;、减少数据库服务器&lt;span style="font-family: Cambria;"&gt;CPU&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;运算&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;4.1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、使用绑定变量&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;绑定变量是指&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中对变化的值采用变量参数的形式提交，而不是在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中直接拼写对应的值。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;非绑定变量写法：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Select * from employee where id=1234567&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;绑定变量写法：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Select * from employee where id=?&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Preparestatement.setInt(1,1234567)&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Java&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Preparestatement&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;就是为处理绑定变量提供的对像，绑定变量有以下优点：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、防止&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;注入&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、提高&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;可读性&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、提高&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;解析性能，不使用绑定变更我们一般称为硬解析，使用绑定变量我们称为软解析。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;第&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;和第&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;点很好理解，做编码的人应该都清楚，这里不详细说明。关于第&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;点，到底能提高多少性能呢，下面举一个例子说明：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;假设有这个这样的一个数据库主机：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;4&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;核&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;块磁盘，每个磁盘支持&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IOPS&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;160&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;业务应用的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;如下：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select * from table where pk=?&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;这个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;平均&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;4&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个索引&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO+1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个数据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;缓存命中率&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;75%&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（索引全在内存中，数据需要访问磁盘）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;硬解析&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;消耗：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1ms&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（常用经验值）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;软解析&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;消耗：&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;0.02ms&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（常用经验值）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;假设&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;每核性能是线性增长，访问内存&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Cache&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;中的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;时间忽略，要求计算系统对如上应用采用硬解析与采用软解析支持的每秒最大并发数：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt;&lt;table style="border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="padding: 0cm 5.4pt; background-color: transparent; width: 104.65pt; border: 1pt solid black;" valign="top" width="140"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;是否使用绑定变量&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 179.4pt;" valign="top" width="239"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;支持最大并发数&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: black black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;磁盘&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;支持最大并发数&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 104.65pt;" valign="top" width="140"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;不使用&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 179.4pt;" valign="top" width="239"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;2*4*1000=&lt;strong&gt;8000&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;100*160=&lt;strong&gt;16000&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-width: medium 1pt 1pt; border-style: none solid solid; border-color: #d4d0c8 black black; padding: 0cm 5.4pt; background-color: transparent; width: 104.65pt;" valign="top" width="140"&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;使用&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 179.4pt;" valign="top" width="239"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;2*4*1000/0.02=&lt;strong&gt;400000&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;td style="border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: #d4d0c8 black black #d4d0c8; padding: 0cm 5.4pt; background-color: transparent; width: 142.05pt;" valign="top" width="189"&gt; &lt;p&gt;&lt;span style="font-family: Calibri;"&gt;&lt;span style="font-size: small;"&gt;100*160=&lt;strong&gt;16000&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;  &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;从以上计算可以看出，不使用绑定变量的系统当并发达到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;8000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;时会在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;上产生瓶颈，当使用绑定变量的系统当并行达到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;16000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;时会在磁盘&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;上产生瓶颈。所以如果你的系统&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;有瓶颈时请先检查是否存在大量的硬解析操作。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;使用绑定变量为何会提高&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;解析性能，这个需要从数据库&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行原理说明，一条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据库中的执行过程如下图所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636679Op5Z.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;当一条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;发送给数据库服务器后，系统首先会将&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字符串进行&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;hash&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;运算，得到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;hash&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;值后再从服务器内存里的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;缓存区中进行检索，如果有相同的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字符，并且确认是同一逻辑的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;语句，则从共享池缓存中取出&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;对应的执行计划，根据执行计划读取数据并返回结果给客户端。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果在共享池中未发现相同的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;则根据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;逻辑生成一条新的执行计划并保存在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;缓存区中，然后根据执行计划读取数据并返回结果给客户端。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;为了更快的检索&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;是否在缓存区中，首先进行的是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字符串&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;hash&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;值对比，如果未找到则认为没有缓存，如果存在再进行下一步的准确对比，所以要命中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;缓存区应保证&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字符是完全一致，中间有大小写或空格都会认为是不同的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果我们不采用绑定变量，采用字符串拼接的模式生成&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL,&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;那么每条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;都会产生执行计划，这样会导致共享池耗尽，缓存命中率也很低。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;一些不使用绑定变量的场景：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;a&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、数据仓库应用，这种应用一般并发不高，但是每个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行时间很长，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;解析的时间相比&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行时间比较小，绑定变量对性能提高不明显。数据仓库一般都是内部分析应用，所以也不太会发生&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;注入的安全问题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;b&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、数据分布不均匀的特殊逻辑，如产品表，记录有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;亿，有一产品状态字段，上面建有索引，有审核中，审核通过，审核未通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;种状态，其中审核通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;9500&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万，审核中&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万，审核不通过&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;499&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;要做这样一个查询：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select count(*) from product where status=?&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;采用绑定变量的话，那么只会有一个执行计划，如果走索引访问，那么对于审核中查询很快，对审核通过和审核不通过会很慢；如果不走索引，那么对于审核中与审核通过和审核不通过时间基本一样；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;对于这种情况应该不使用绑定变量，而直接采用字符拼接的方式生成&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，这样可以为每个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;生成不同的执行计划，如下所示。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;select count(*) from product where status='approved'; //&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;不使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;select count(*) from product where status='tbd'; //&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;不使用索引&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;select count(*) from product where status='auditing';//&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;使用索引&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;4.2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、合理使用排序&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Oracle&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的排序算法一直在优化，但是总体时间复杂度约等于&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;nLog(n)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。普通&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;OLTP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;系统排序操作一般都是在内存里进行的，对于数据库来说是一种&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的消耗，曾在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;PC&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;机做过测试，单核普通&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;秒钟可以完成&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;100&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万条记录的全内存排序操作，所以说由于现在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的性能增强，对于普通的几十条或上百条记录排序对系统的影响也不会很大。但是当你的记录集增加到上万条以上时，你需要注意是否一定要这么做了，大记录集排序不仅增加了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销，而且可能会由于内存不足发生硬盘排序的现象，当发生硬盘排序时性能会急剧下降，这种需求需要与&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;沟通再决定，取决于你的需求和数据，所以只有你自己最清楚，而不要被别人说排序很慢就吓倒。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以下列出了可能会发生排序操作的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;语法：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Order by&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Group by&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Distinct&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Exists&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;子查询&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Not Exists&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;子查询&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;In&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;子查询&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Not In&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;子查询&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Union&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（并集），&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Union All&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;也是一种并集操作，但是不会发生排序，如果你确认两个数据集不需要执行去除重复数据操作，那请使用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Union All &lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;代替&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Union&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Minus&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（差集）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Intersect&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;（交集）&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;Create Index&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Merge Join&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，这是一种两个表连接的内部算法，执行时会把两个表先排序好再连接，应用于两个大表连接的操作。如果你的两个表连接的条件都是等值运算，那可以采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Hash Join&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;来提高性能，因为&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Hash Join&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;使用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Hash &lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;运算来代替排序的操作。具体原理及设置参考&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;执行计划优化专题。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;4.3&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、减少比较操作&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;我们&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的业务逻辑经常会包含一些比较操作，如&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;a=b&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;a&amp;lt;b&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;之类的操作，对于这些比较操作数据库都体现得很好，但是如果有以下操作，我们需要保持警惕：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;Like&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;模糊查询，如下所示：&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;a like &amp;#8216;%abc%&amp;#8217;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;Like&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;模糊查询对于数据库来说不是很擅长，特别是你需要模糊检查的记录有上万条以上时，性能比较糟糕，这种情况一般可以采用专用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Search&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;或者采用全文索引方案来提高性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size: small;"&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;不能使用索引定位的大量&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;In List&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 宋体;"&gt;，如下所示：&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;a in (:1,:2,:3,&amp;#8230;,:n)&lt;span&gt;&amp;nbsp;&amp;nbsp; ----n&amp;gt;20&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果这里的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;a&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;字段不能通过索引比较，那数据库会将字段与&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;in&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;里面的每个值都进行比较运算，如果记录数有上万以上，会明显感觉到&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;开销加大，这个情况有两种解决方式：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;a、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;将&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;in&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;列表里面的数据放入一张中间小表，采用两个表&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Hash Join&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;关联的方式处理；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt;"&gt;&lt;span&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;b、&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;采用&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;str2varList&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;方法将字段串列表转换一个临时表处理，关于&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt;str2varList&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family: 宋体;"&gt;方法可以在网上直接查询，这里不详细介绍。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;以上两种解决方案都需要与中间表&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Hash Join&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的方式才能提高性能，如果采用了&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;Nested Loop&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的连接方式性能会更差。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 18pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果发现我们的系统&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;没问题但是&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;负载很高，就有可能是上面的原因，这种情况不太常见，如果遇到了最好能和&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;沟通并确认准确的原因。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;4.4&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、大量复杂运算在客户端处理&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;什么是复杂运算，一般我认为是一秒钟&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;只能做&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万次以内的运算。如含小数的对数及指数运算、三角函数、&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;3DES&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;及&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;BASE64&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;数据加密算法等等。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果有大量这类函数运算，尽量放在客户端处理，一般&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;每秒中也只能处理&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;-10&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;万次这样的函数运算，放在数据库内不利于高并发处理。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Cambria; font-size: large;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、利用更多的资源&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;5.1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、客户端多进程并行访问&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;多进程并行访问是指在客户端创建多个进程&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;(&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;线程&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;)&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，每个进程建立一个与数据库的连接，然后同时向数据库提交访问请求。当数据库主机资源有空闲时，我们可以采用客户端多进程并行访问的方法来提高性能。如果数据库主机已经很忙时，采用多进程并行访问性能不会提高，反而可能会更慢。所以使用这种方式最好与&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;DBA&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;或系统管理员进行沟通后再决定是否采用。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;例如：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;我们有&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个产品&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，现在需要根据&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;取出产品的详细信息，如果单线程访问，按每个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;5ms&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;计算，忽略主机&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;运算及网络传输时间，我们需要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;50s&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;才能完成任务。如果采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;5&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个并行访问，每个进程访问&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;2000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;ID&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;，那么&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;10s&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;就有可能完成任务。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;那是不是并行数越多越好呢，开&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;1000&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;个并行是否只要&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;50ms&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;就搞定，答案肯定是否定的，当并行数超过服务器主机资源的上限时性能就不会再提高，如果再增加反而会增加主机的进程间调度成本和进程冲突机率。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;以下是一些如何设置并行数的基本建议：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果瓶颈在服务器主机，但是主机还有空闲资源，那么最大并行数取主机&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;核数和主机提供数据服务的磁盘数两个参数中的最小值，同时要保证主机有资源做其它任务。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果瓶颈在客户端处理，但是客户端还有空闲资源，那建议不要增加&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的并行，而是用一个进程取回数据后在客户端起多个进程处理即可，进程数根据客户端&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;核数计算。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;如果瓶颈在客户端网络，那建议做数据压缩或者增加多个客户端，采用&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;map reduce&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的架构处理。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;如果瓶颈在服务器网络，那需要增加服务器的网络带宽或者在服务端将数据压缩后再处理了。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="font-family: Calibri; font-size: large;"&gt;5.2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: large;"&gt;、数据库并行处理&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;数据库并行处理是指客户端一条&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;的请求，数据库内部自动分解成多个进程并行处理，如下图所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;&lt;img src="http://hi.csdn.net/attachment/201012/6/0_1291636683c2zz.gif" alt="" /&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;并不是所有的&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;都可以使用并行处理，一般只有对表或索引进行全部访问时才可以使用并行。数据库表默认是不打开并行访问，所以需要指定&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;SQL&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;并行的提示，如下所示：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-family: Calibri; font-size: small;"&gt;select &lt;strong&gt;/*+parallel(a,4)*/ &lt;/strong&gt;* from employee;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;并行的优点：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: 宋体;"&gt;使用多进程处理，充分利用数据库主机资源（&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;CPU,IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;），提高性能。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;并行的缺点：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、单个会话占用大量资源，影响其它会话，所以只适合在主机负载低时期使用；&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、只能采用直接&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;IO&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;访问，不能利用缓存数据，所以执行前会触发将脏缓存数据写入磁盘操作。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="font-size: small;"&gt;注：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;1&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、并行处理在&lt;/span&gt;&lt;span style="font-family: Calibri;"&gt;OLTP&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;类系统中慎用，使用不当会导致一个会话把主机资源全部占用，而正常事务得不到及时响应，所以一般只是用于数据仓库平台。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-indent: 21pt;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Calibri;"&gt;2&lt;/span&gt;&lt;span style="font-family: 宋体;"&gt;、一般对于百万级记录以下的小表采用并行访问性能并不能提高，反而可能会让性能更差。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/chy8219/aggbug/1933857.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/chy8219/archive/2011/01/12/1933857.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2009/08/21/1551204.html</id><title type="text">http https无缝切换</title><summary type="text">一般我们实现http和https无缝切换，都是用相对路径实现：&amp;lt;img src='/pix/smiley.jpg' /&amp;gt;&amp;lt;img src='smiley.jpg' /&amp;gt;但是如果是外部资源就郁闷了，因为写死了是http://，这个时候用https访问主站，IE之类的浏览器就会提示：即将载入混合内容页面是否继续。这个对话框点击&amp;#8220;是&amp;#8221;就可以跳过，但是会让用...</summary><published>2009-08-21T02:34:00Z</published><updated>2009-08-21T02:34:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2009/08/21/1551204.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2009/08/21/1551204.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2009/07/02/1515653.html</id><title type="text">ADO.NET 的最佳实践技巧</title><summary type="text">这是我很早以前看过的微软的一篇文章，最近，一些网友问的问题很多理论都在里面，所以，整理一下放在这里，大家可以参考一下。 简介本文为您提供了在 Microsoft ADO.NET 应用程序中实现和获得最佳性能、可伸缩性以及功能的最佳解决方案；同时也讲述了使用 ADO.NET 中可用对象的最佳实践；并提出一些有助于优化 ADO.NET 应用程序设计的建议。本文包含： &amp;#8226;有关 .NET 框架...</summary><published>2009-07-02T08:57:00Z</published><updated>2009-07-02T08:57:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2009/07/02/1515653.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2009/07/02/1515653.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2009/05/15/1457184.html</id><title type="text">模板引擎的一种实现</title><summary type="text">什么是模板引擎？说白了就是能够自动替换占位符的替换引擎。原理上也就是两个步骤，找到-》替换。但是替换不是简单的替换，包括：简单变量替换();复杂变量替换();对象变量替换();键值类型替换();自定义集合替换();同时显示多个变量();模板调用();给调用模板传参数();值模板();简单循环();交差循环显示();通过模板交差循环();条件判断();从文件中创建模板();常用的模板引擎，Strin...</summary><published>2009-05-14T16:36:00Z</published><updated>2009-05-14T16:36:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2009/05/15/1457184.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2009/05/15/1457184.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2009/05/10/1453539.html</id><title type="text">虚拟主机时常出现MAC验证失败错误之解决方法(转)</title><summary type="text">出现错误： 解决方法：因为.NET在对客户端数据与服务器间传送过程中，需要对数据进行加密与解密，而加密与解密算法可以在web.config里进行配置，在web.config中，validationKey和decryptionKey的默认值是AutoGenerate，由系统随机生成密钥，如果在本地或者使用的是独立主机通常不会有什么问题，但是使用虚拟主机，一台服务器上有多个虚拟主机存在时就会出现以上问...</summary><published>2009-05-10T02:10:00Z</published><updated>2009-05-10T02:10:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2009/05/10/1453539.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2009/05/10/1453539.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2009/01/24/1380627.html</id><title type="text">转载 软件架构师应该具备的素质(Enterprise Solution Architects and Leadership)</title><summary type="text">旧一篇:100 Interview Questions for Software Developers 软件/企业架构师是一项很重要的工作。架构师的职责很多，要胜任的话，需要具备特定的领导、沟通、技术技能。 GabrielMorgan在最近的一篇帖子里从DanielGoleman的情感智能（EI）——自我意识、自我管理、社会意识和关系管理——切入，谈论了企业软件架构师应该具备的素质。 自我意识 *...</summary><published>2009-01-24T01:30:00Z</published><updated>2009-01-24T01:30:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2009/01/24/1380627.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2009/01/24/1380627.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2008/08/27/1277722.html</id><title type="text">asp.net Cookies 转码的问题 中文丢失 </title><summary type="text">因为asp.net使用UTF-8的文字编码来显示GB2312的中文，所以有的时候会出现乱码，尤其在cookies的时候，更甚至是我们在web.config中这样设置之后&amp;lt;globalization requestEncoding="gb2312" responseEncoding="gb2312"/&amp;gt;，会导致我们的中文cookie变成乱码，从而导致cookies无效，因此要将cooki...</summary><published>2008-08-27T06:53:00Z</published><updated>2008-08-27T06:53:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2008/08/27/1277722.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2008/08/27/1277722.html"/></entry><entry><id>http://www.cnblogs.com/chy8219/archive/2008/08/04/1259839.html</id><title type="text">.NET面试题，看看你的水平[转]</title><summary type="text">1.DateTime.Parse(myString); 这行代码有什么问题？2.PDB是什么东西? 在调试中它应该放在哪里？ 3.什么叫圈复杂度（cyclomatic complexity）？为什么它很重要？ 4.写一个标准的lock()，在访问变量的前后创建临界区，要有"双重检查"， 5.什么叫FullTrust？放入GAC的assembly是否是FullTrust的? 6.代码加上需要安全权限...</summary><published>2008-08-04T05:34:00Z</published><updated>2008-08-04T05:34:00Z</updated><author><name>陳龑</name><uri>http://www.cnblogs.com/chy8219/</uri></author><link rel="alternate" href="http://www.cnblogs.com/chy8219/archive/2008/08/04/1259839.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/chy8219/archive/2008/08/04/1259839.html"/></entry></feed>
