﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>博客园-Teddy's Knowledge Base</title><link>http://www.cnblogs.com/teddyma/</link><description /><language>zh-cn</language><lastBuildDate>Wed, 10 Feb 2010 01:51:22 GMT</lastBuildDate><pubDate>Wed, 10 Feb 2010 01:51:22 GMT</pubDate><ttl>60</ttl><item><title>NIntegrate v0.9.0.1 released</title><link>http://www.cnblogs.com/teddyma/archive/2010/01/23/1654547.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Fri, 22 Jan 2010 17:17:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2010/01/23/1654547.html</guid><description><![CDATA[<p>阅读: 179 评论: 2 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2010-01-23 01:17 <a href="http://www.cnblogs.com/teddyma/archive/2010/01/23/1654547.html" target="_blank">原文链接</a></p><p><strong>Project Site:</strong><br /></p><p><a target="_blank" href="http://nintegrate.com/">http://nintegrate.com</a></p><p><br /></p><p><strong>Download: </strong></p><p><a target="_blank" href="http://code.google.com/p/nintegrate/source/checkout">Download from SVN</a></p> 		<p><a target="_blank" href="http://code.google.com/p/nintegrate/downloads/list">Download from Google Code</a></p> 		<p><a target="_blank" href="http://nintegrate.codeplex.com/Release/ProjectReleases.aspx">Download from CodePlex</a></p><br /><p>&nbsp;</p><img src="http://www.cnblogs.com/teddyma/aggbug/1654547.html?type=1" width="1" height="1" alt=""/><p>评论: 2　<a href="http://www.cnblogs.com/teddyma/archive/2010/01/23/1654547.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2010/01/23/1654547.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>.NET Enterprise SOA – NIntegrate Practice</title><link>http://www.cnblogs.com/teddyma/archive/2010/01/20/1652751.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Wed, 20 Jan 2010 13:58:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2010/01/20/1652751.html</guid><description><![CDATA[<p>阅读: 1042 评论: 18 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2010-01-20 21:58 <a href="http://www.cnblogs.com/teddyma/archive/2010/01/20/1652751.html" target="_blank">原文链接</a></p><p><a href="http://nintegrate.com/" target="_blank">NIntegrate</a> is open source .NET enterprise SOA framework. It provides several reusable SOA components to solve specific enterprise SOA problems. Different from some other one-in-one SOA solution, <a href="http://nintegrate.com/" target="_blank">NIntegrate</a> is designed to be easily integrated with your company&#8217;s application frameworks.<br />
</p>
<h4><strong>Problems NIntegrate solves: </strong></h4>
1) Decouple WCF configuration from Web.config/App.config files.<br />
2) Dynamic query through WCF.<br />
3) Flexible object mapping.<br />
4) LRU dictionary &amp; caching. <br />
5) Single thread worker queue.<br />
<h4><strong>Read the article for details:</strong><br />
</h4>
<p><a target="_blank" href="http://www.cnblogs.com/teddyma/articles/1651126.html">.NET Enterprise SOA &#8211; NIntegrate Practice</a></p>
<p><a target="_blank" href="http://www.cnblogs.com/teddyma/articles/1651126.html">http://www.cnblogs.com/teddyma/articles/1651126.html</a></p>
<p><br />
</p><img src="http://www.cnblogs.com/teddyma/aggbug/1652751.html?type=1" width="1" height="1" alt=""/><p>评论: 18　<a href="http://www.cnblogs.com/teddyma/archive/2010/01/20/1652751.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2010/01/20/1652751.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>Enterprise WCF - Integrate WCF Configuration into Your Enterprise Framework</title><link>http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Fri, 28 Aug 2009 15:46:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html</guid><description><![CDATA[<p>阅读: 1713 评论: 15 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-08-28 23:46 <a href="http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html" target="_blank">原文链接</a></p><h3>Background</h3> <p>Lots of people declares they are using WCF in their &#8220;enterprise&#8221; distributed software development together with other SOA technologies, and even calls their software architecture WCF based. If you are one of them, could you please answer the questions below; or, if you plan to be one of them, ask yourself the questions below:</p> <ul> <li>How many WCF services are their in your enterprise architecture?  </li><li>How many sub-systems and databases?  </li><li>How many servers deploying or consuming WCF services?  </li><li>How many load-balanced server farms and application tiers related to WCF?  </li><li>How many deployment server environments (DEV, QA, Staging, Production, etc)?  </li><li>Are your servers and farms in different domains, with different connectivity and different network bandwidth?  </li><li>What are your auto-build, test and release processes for WCF services?  </li><li>How do you deal with the WCF service configuration difference for different deployment server environments?  </li><li>How often are your WCF service configuration changed?  </li><li>How do you maintain your WCF service configuration changes?  </li><li>Where are your WCF service configuration saved?</li></ul> <p>The goal to ask the questions above is to lead you thinking &amp; agree:</p> <ul> <li>The management of WCF services in enterprise distributed software development is not an easy stuff.  </li><li>To put WCF service configuration in your application configuration files is a nightmare for enterprise distributed software development.  </li><li>For enterprise distributed software development involving WCF service, an &#8220;enterprise framework&#8221; integrating consistent centralized WCF service configuration management is highly necessary.</li></ul> <p>Let me give a definition for &#8220;<strong>enterprise framework</strong>&#8221; discussed in this text: a set of shared software development components, and related configuration persistence and development &amp; management process for all the distributed application development in enterprise.</p> <p>Give you an example of &#8220;<strong>enterprise framework</strong>&#8221; in my company, even before using WCF, we already have a set of shared software components (VJ++/VB/DotNet COM DLLs for Non-DotNet applications; and DotNet DLLs for all DotNet applications), and a centralized database based configuration store for all the application app settings, connection strings, Web Service URLs and dependency injected object factory. We also have related development, maintain and release process for both the software components and the data in the configuration store.</p> <p>Since you agree (I assumes) about the &#8220;the goal to ask the questions&#8221; above, when beginning to widely use WCF in our enterprise application development, you could imagine, we try to integrate WCF service configuration into our enterprise framework.</p> <p><a href="http://www.cnblogs.com/teddyma/archive/2009/03/23/1419329.html">Articles I posted before</a> already shows the possibility to centralize and programmatically configure all WCF service configuration. The rest of this text will introduce the summary of how we integrate WCF service configuration into our enterprise framework, and show you how to easily integrate WCF service configuration into other frameworks on the top of <a href="http://nintegrate.com/">NIntegrate</a> &#8211; an open source DotNet integration framework.</p> <h3>How We Integrate WCF Configuration into Our Enterprise Framework</h3> <p>I don&#8217;t want to expose any confidential information of my company, the purpose of this chapter is only to show you the benefits we get from the solution and give you more confidence to adopt a similar solution.</p> <ul> <li>Since we put all the configuration for applications in centralized database even before using WCF, the most suitable place to save all WCF configuration is the same database. And because our existing configuration are grouped by servers, load-balanced server farms and different applications, when extending the database to support WCF configuration, we easily get the ability to reuse WCF configuration at application, server or even farm scope for contracts, addresses, bindings, behaviors, security, etc.  </li><li>Since we put all the configuration in database instead of application configuration files, our applications could have very light application configuration files, and even no application files. This makes the auto-build &amp; deployment of our application on different deployment server environment be super easy - no code change required for release packages on different server environments.  </li><li>To read configuration from database for publishing &amp; consuming WCF services, we created some shared components (DotNet components only) to our development framework library, including custom ServiceHost Factory for hosting services and custom ChannelFactory for consuming services. For non-DotNet applications, they could also consume WCF services through Web Service binding or through DotNet COM wrappers (for windows apps only).  </li><li>The shared components not only read &amp; cache WCF configuration from database, but also automatically refresh the cache in memory through background threads according to specified refresh policy, so it is easy to change WCF configuration at runtime, ex., disable/enable services or endpoints, change bindings, addresses or other settings, apply consistent health monitor, performance trace, error handling &amp; logging, etc, through custom behaviors or other extension APIs of WCF.</li></ul> <h3>Integrate WCF Configuration into a Dummy Enterprise Framework on the Top of NIntegrate</h3> <p>To demonstrate how to integrate WCF configuration into an enterprise framework, I&#8217;ll introduce a dummy enterprise framework in this chapter.</p> <p>The attached picture is the class diagram of dummy enterprise framework integrated with NIntegrate:</p> <p><a href="http://images.cnblogs.com/cnblogs_com/teddyma/WindowsLiveWriter/IntegrateWCFConfigurationintoYourCurrent_14219/ClassDiagram_4.png"><img title="ClassDiagram" style="border-width: 0px; display: inline;" alt="ClassDiagram" src="http://images.cnblogs.com/cnblogs_com/teddyma/WindowsLiveWriter/IntegrateWCFConfigurationintoYourCurrent_14219/ClassDiagram_thumb_1.png" width="595" border="0" height="372" /></a> </p> <p>Before integrated with <a href="http://nintegrate.com/"></a><a target="">NIntegrate</a>, all the classes and methods containing the word &#8216;Wcf&#8217; does not exist. The Dummy framework provides abilities to create class instances dependency injected, and get application variables &amp; connection strings centrally, which are very common functions an enterprise framework may provide.</p> <p>To use the DummyFramework, easily call DummyFrameworkConfigurationManager.GetConfiguration() to get an instance of DummyFrameworkConfiguration, and use it to construct a DummyFramework instance. Then you can call methods on DummyFramework. </p> <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>  <p>On the top of <a href="http://nintegrate.com/">NIntegrate</a>, we could easily give the WCF configuration &amp; custom persistence ability to the dummy framework.</p> <p>To consume a WCF service, call the CreateWcfChannel&lt;T&gt;() method on DummyFramework, inside which reads WCF client endpoint configuration from DummyFrameworkConfiguration, which internally could load the configuration from anywhere rather than only in application configuration file (The returning instance is WcfClientEndpoint class, which is a serializable WCF DataContract defined in <a href="http://nintegrate.com/">NIntegrate</a>). The CreateWcfChannel&lt;T&gt;() method calls WcfChannelFactoryFactory.CreateChannelFactory&lt;TChannel&gt;() method, which is defined in <a href="http://nintegrate.com/">NIntegrate</a>, creates the ChannelFactory, cache it and returns an instance of WcfChannelWrapper class (also defined in NIntegrate), which implements the best practice for disposing a WCF channel instance.</p> <p>Sample code as below:</p><pre class="csharpcode">    var df = <span class="kwrd">new</span> DummyFramework(DummyFrameworkConfiguationManager.GetConfiguration());<br />    <span class="kwrd">using</span> (var wrapper = df.CreateWcfChannel&lt;IDummyService&gt;())<br />    {<br />        Response.Write(wrapper.Channel.SayHello());<br />    }</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>To publish a WcfService, create the DummyWcfServiceHostFactory class, and set the Factory property of a .svc file as below:</p><pre class="csharpcode"><span class="asp">&lt;%@ ServiceHost Service="DummyEnterpriseService.Implementation.DummyService"<br />    Factory="DummyEnterpriseFramework.DummyWcfServiceHostFactory" %&gt;</span></pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>

<p>The DummyWcfServiceHostFactory class inherits the WcfServiceHostFactory class defined in NIntegrate, and overrides the LoadServiceConfiguration() method to load configuration from anywhere expected (The returning instance is WcfService class, which is a serializable Wcf DataContract defined in <a href="http://nintegrate.com/">NIntegrate</a>).</p>
<p>Attached the source code of the sample DummyEnterpriseFrameworkIntegration:</p>
<p><a href="http://files.cnblogs.com/teddyma/DummyEnterpriseFrameworkIntegration.zip">DummyEnterpriseFrameworkIntegration.zip</a></p>
<p><br /></p><p><strong>Original by <a href="http://www.cnblogs.com/teddyma">Teddy's Knowledge Base</a>, All rights reserved.</strong></p><p>First Publish: <a id="Editor_Edit_hlEntryLink" title="view: Enterprise WCF - Integrate WCF Configuration into Your Enterprise Framework" href="http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html" target="_blank">http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html</a></p><p><a id="Editor_Edit_hlEntryLink" title="view: Enterprise WCF - Integrate WCF Configuration into Your Enterprise Framework" href="http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html" target="_blank"><br /></a></p><p>//The end</p><img src="http://www.cnblogs.com/teddyma/aggbug/1556076.html?type=1" width="1" height="1" alt=""/><p>评论: 15　<a href="http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/08/28/1556076.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>NIntegrate近期动态08/06</title><link>http://www.cnblogs.com/teddyma/archive/2009/08/06/1540090.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Thu, 06 Aug 2009 01:55:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/08/06/1540090.html</guid><description><![CDATA[<p>阅读: 885 评论: 5 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-08-06 09:55 <a href="http://www.cnblogs.com/teddyma/archive/2009/08/06/1540090.html" target="_blank">原文链接</a></p>NIntegrate (<a target="_blank" href="http://nintegrate.com/">http://nintegrate.com/</a>) 是Teddy近期在维护的开源SOA开发框架。原本计划在近期能达到1.0版本，不过，在0.8之后，经过很多深入的思考和工作中的相关应用实践，决定进行较大的重构，或者说重新设计更合适。以下是在0.9中将包含的部分重大修改：
<div>
<ol>
    <li>首先，新设计的核心模块不再依赖并默认提供基于SQL Server数据库的集中化配置实现和相关UI。取而代之的是一个更加灵活的，易于和第三方系统，框架进行整合的API。使得无论对个人用户的简单应用，还是企业级用户整合到现有的系统都更方便和灵活。</li>
    <li>新设计目前包含三个DLL：NIntegrate.ServiceModel.dll提供了一组对WCF动态配置的API，彻底摆脱对Web.config/App.config的依赖，完备的配置所有&lt;system.ServiceModel&gt;配置中的WCF服务的ABC和自定义扩展等配置信息；NIntegrate.Data.dll提供了一组套多数据库支持，跨WCF，COM兼容的强类型高性能数据库查询语言，支持CRUD和存储过程整合；NIntegrate.Web.dll提供了对上两个DLL的Web扩展，包括基于Web的WCF配置实时在线编辑和持久化控件以及基于WCF和上述查询语言的DataSource控件。</li>
</ol>
<div><br />
</div>
<div>未完待续。。。</div>
</div><img src="http://www.cnblogs.com/teddyma/aggbug/1540090.html?type=1" width="1" height="1" alt=""/><p>评论: 5　<a href="http://www.cnblogs.com/teddyma/archive/2009/08/06/1540090.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/08/06/1540090.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>EF上海再次急招.NET Senior Developer，有意者请和我联系[08/06更新]</title><link>http://www.cnblogs.com/teddyma/archive/2009/06/29/1512956.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Mon, 29 Jun 2009 01:28:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/06/29/1512956.html</guid><description><![CDATA[<p>阅读: 1052 评论: 6 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-06-29 09:28 <a href="http://www.cnblogs.com/teddyma/archive/2009/06/29/1512956.html" target="_blank">原文链接</a></p><p><font color="#000080" face="Arial" size="4"><span style="font-size: 15px;">有意者请点击下面的链接给我留言：</span></font></p>
<p><font color="#000080" face="Arial" size="4"><span style="font-size: 15px;"><a target="_blank" href="http://www.cnblogs.com/teddyma/contact.aspx?id=1">http://www.cnblogs.com/teddyma/contact.aspx?id=1</a></span></font></p>
<p><font color="#000080" face="Arial" size="4"><span style="font-size: 15px;">
</span></font></p>
<font color="#000080" face="Arial" size="4">
<div>
<table align="left" cellpadding="0" cellspacing="0" vspace="0" hspace="0">
    <tr>
        <td style="padding: 5pt 9pt;" align="left" valign="top">
        <p class="MsoNormal"><strong><em><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">Position: Senior Software Engineer</span></em></strong><strong><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><o:p></o:p></span></strong></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">(full-time
        position, based in </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US"><ns0:city><ns0:place><span style="color: black;">Shanghai</span></ns0:place></ns0:city><span style="color: black;">)<o:p></o:p></span></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><br />
        * Bachelors degree in computer science, Master&#8217;s desirable<br />
        * Over 4 years solid working experience on software developing <br />
        * Good skill on Visual Studio, client-side scripting, Java, ASP.NET (VB), C#<br />
        * Strong SQL Server,&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: blue;" lang="EN-US">&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">J</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">avaScript, HTML, XML, XSLT, CSS., webservices.<br />
        * Good communication skill and good teamwork sprit<br />
        * Can work under pressure and be willing to meet the challenge <br />
        * Fluency in English, both on speaking and writing</span><span lang="EN-US"><o:p></o:p></span></p>
        </td>
    </tr>
</table>
</div>
</font>
<p>&nbsp;</p><img src="http://www.cnblogs.com/teddyma/aggbug/1512956.html?type=1" width="1" height="1" alt=""/><p>评论: 6　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/29/1512956.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/29/1512956.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>AdoNet vs LinqToSql vs NIntegrateQuery查询性能测试</title><link>http://www.cnblogs.com/teddyma/archive/2009/06/07/1497903.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Sat, 06 Jun 2009 17:45:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/06/07/1497903.html</guid><description><![CDATA[<p>阅读: 2887 评论: 13 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-06-07 01:45 <a href="http://www.cnblogs.com/teddyma/archive/2009/06/07/1497903.html" target="_blank">原文链接</a></p><p>AdoNet vs LinqToSql vs NIntegrateQuery查询性能测试. </p><p>先上测试结果: </p><p>AdoNetTest: 267ms<br />AdoNetCachedCommandTest: 182ms<br />LinqToSqlTest: 3191ms<br />LinqToSqlCompiledQueryTest: 386ms<br />NIntegrateQueryTest: 266ms </p><h3>下载</h3> <p>下载测试数据库：<a href="http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=MSFTDBProdSamples&amp;DownloadId=61985&amp;FileTime=128816120189200000&amp;Build=15123"><span style="color: #0000ff;">AdventureWorksLT2008</span></a> </p><p>下载测试代码：<a href="http://files.cnblogs.com/teddyma/NIntegrateQueryPerformanceComparison.zip"><span style="color: #0000ff;">NIntegrateQueryPerformanceComparison.zip</span></a> </p><h3>代码导航</h3><div class="cnblogs_code"><img id="Code_Closed_Image_013743" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013743').style.display='none'; document.getElementById('Code_Open_Image_013743').style.display='inline'; document.getElementById('Code_Open_Text_013743').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" height="16"><img id="Code_Open_Image_013743" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013743').style.display='none'; getElementById('Code_Closed_Image_013743').style.display='inline'; getElementById('Code_Closed_Text_013743').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" height="16"><span id="Code_Closed_Text_013743" class="cnblogs_code_Collapse">AdoNetTest.cs</span><span id="Code_Open_Text_013743" style="display: none;"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;AdoNetTest&nbsp;:&nbsp;ITest<br /></span><span style="color: #008080;">&nbsp;2</span><span style="color: #000000;"><img id="Codehighlighter1_33_1600_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_33_1600_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_33_1600_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_33_1600_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_33_1600_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_33_1600_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_33_1600_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_33_1600_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_33_1600_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_33_1600_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">readonly</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;_connString&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ConfigurationManager.ConnectionStrings[Constants.ConnectingStringName].ConnectionString;<br /></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;DoExecute(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;repeatTime)<br /></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img id="Codehighlighter1_233_1370_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_233_1370_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_233_1370_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_233_1370_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_233_1370_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_233_1370_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_233_1370_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_233_1370_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_233_1370_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_233_1370_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(var&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #800080;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;repeatTime;&nbsp;</span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br /></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img id="Codehighlighter1_297_1360_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_297_1360_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_297_1360_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_297_1360_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_297_1360_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_297_1360_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_297_1360_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_297_1360_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_297_1360_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_297_1360_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;conn&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlConnection(_connString))<br /></span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="Codehighlighter1_381_1346_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_381_1346_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_381_1346_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_381_1346_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_381_1346_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_381_1346_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_381_1346_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_381_1346_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_381_1346_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_381_1346_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(conn.State&nbsp;</span><span style="color: #000000;">!=</span><span style="color: #000000;">&nbsp;System.Data.ConnectionState.Open)<br /></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conn.Open();<br /></span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;cmd&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlCommand(<br /></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #800000;">"</span><span style="color: #800000;">SELECT&nbsp;TOP&nbsp;1&nbsp;ProductID,Name&nbsp;FROM&nbsp;SalesLT.Product&nbsp;WHERE&nbsp;ProductID&nbsp;=&nbsp;@ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">,&nbsp;conn)<br /></span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="Codehighlighter1_683_727_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_683_727_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_683_727_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_683_727_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_683_727_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_683_727_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_683_727_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_683_727_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_683_727_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_683_727_Open_Text"><span style="color: #000000;">{CommandType&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;System.Data.CommandType.Text}</span></span><span style="color: #000000;">;<br /></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Parameters.Add(</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlParameter(</span><span style="color: #800000;">"</span><span style="color: #800000;">@ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">,&nbsp;i));<br /></span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;reader&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;cmd.ExecuteReader())<br /></span><span style="color: #008080;">18</span><span style="color: #000000;"><img id="Codehighlighter1_885_1328_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_885_1328_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_885_1328_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_885_1328_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_885_1328_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_885_1328_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_885_1328_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_885_1328_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_885_1328_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_885_1328_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(reader.Read())<br /></span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="Codehighlighter1_954_1306_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_954_1306_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_954_1306_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_954_1306_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_954_1306_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_954_1306_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_954_1306_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_954_1306_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_954_1306_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_954_1306_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;product&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;Product<br /></span><span style="color: #008080;">22</span><span style="color: #000000;"><img id="Codehighlighter1_1056_1279_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1056_1279_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1056_1279_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1056_1279_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1056_1279_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1056_1279_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1056_1279_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1056_1279_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1056_1279_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1056_1279_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProductID&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">int</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">]),<br /></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">string</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">Name</span><span style="color: #800000;">"</span><span style="color: #000000;">])<br /></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;">;<br /></span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">32</span><span style="color: #000000;"><img id="Codehighlighter1_1380_1594_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1380_1594_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1380_1594_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1380_1594_Open_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1380_1594_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1380_1594_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1380_1594_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1380_1594_Closed_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1380_1594_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff;">ITest&nbsp;Members</span><span id="Codehighlighter1_1380_1594_Open_Text" style="display: none;"><span style="color: #0000ff;">#region</span><span style="color: #000000;">&nbsp;ITest&nbsp;Members</span><span style="color: #000000;"><br /></span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Prepare()<br /></span><span style="color: #008080;">35</span><span style="color: #000000;"><img id="Codehighlighter1_1441_1478_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1441_1478_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1441_1478_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1441_1478_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1441_1478_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1441_1478_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1441_1478_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1441_1478_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1441_1478_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1441_1478_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(</span><span style="color: #800080;">1</span><span style="color: #000000;">);<br /></span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Execute()<br /></span><span style="color: #008080;">40</span><span style="color: #000000;"><img id="Codehighlighter1_1518_1574_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1518_1574_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1518_1574_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1518_1574_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1518_1574_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1518_1574_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1518_1574_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1518_1574_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1518_1574_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1518_1574_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(Constants.RepeatTime);<br /></span><span style="color: #008080;">42</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">#endregion</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">45</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">46</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span></div><p>&nbsp;</p><div class="cnblogs_code"><img id="Code_Closed_Image_013830" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013830').style.display='none'; document.getElementById('Code_Open_Image_013830').style.display='inline'; document.getElementById('Code_Open_Text_013830').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" height="16"><img id="Code_Open_Image_013830" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013830').style.display='none'; getElementById('Code_Closed_Image_013830').style.display='inline'; getElementById('Code_Closed_Text_013830').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" height="16"><span id="Code_Closed_Text_013830" class="cnblogs_code_Collapse">AdoNetCachedCommandTest.cs</span><span id="Code_Open_Text_013830" style="display: none;"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;AdoNetCachedCommandTest&nbsp;:&nbsp;ITest<br /></span><span style="color: #008080;">&nbsp;2</span><span style="color: #000000;"><img id="Codehighlighter1_46_1994_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_46_1994_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_46_1994_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_46_1994_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_46_1994_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_46_1994_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_46_1994_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_46_1994_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_46_1994_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_46_1994_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">readonly</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;_connString&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ConfigurationManager.ConnectionStrings[Constants.ConnectingStringName].ConnectionString;<br /></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;SqlCommand&nbsp;_cachedCommand;<br /></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;SqlCommand&nbsp;GetCachedCommand()<br /></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img id="Codehighlighter1_301_739_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_301_739_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_301_739_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_301_739_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_301_739_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_301_739_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_301_739_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_301_739_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_301_739_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_301_739_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(_cachedCommand&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">null</span><span style="color: #000000;">)<br /></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img id="Codehighlighter1_355_685_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_355_685_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_355_685_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_355_685_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_355_685_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_355_685_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_355_685_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_355_685_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_355_685_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_355_685_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_cachedCommand&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlCommand(<br /></span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #800000;">"</span><span style="color: #800000;">SELECT&nbsp;TOP&nbsp;1&nbsp;ProductID,Name&nbsp;FROM&nbsp;SalesLT.Product&nbsp;WHERE&nbsp;ProductID&nbsp;=&nbsp;@ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">)<br /></span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="Codehighlighter1_544_588_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_544_588_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_544_588_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_544_588_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_544_588_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_544_588_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_544_588_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_544_588_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_544_588_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_544_588_Open_Text"><span style="color: #000000;">{CommandType&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;System.Data.CommandType.Text}</span></span><span style="color: #000000;">;<br /></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_cachedCommand.Parameters.Add(</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlParameter(</span><span style="color: #800000;">"</span><span style="color: #800000;">@ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">,&nbsp;</span><span style="color: #800080;">0</span><span style="color: #000000;">));<br /></span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">return</span><span style="color: #000000;">&nbsp;_cachedCommand.Clone();<br /></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;DoExecute(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;repeatTime)<br /></span><span style="color: #008080;">19</span><span style="color: #000000;"><img id="Codehighlighter1_796_1764_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_796_1764_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_796_1764_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_796_1764_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_796_1764_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_796_1764_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_796_1764_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_796_1764_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_796_1764_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_796_1764_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(var&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #800080;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;repeatTime;&nbsp;</span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br /></span><span style="color: #008080;">21</span><span style="color: #000000;"><img id="Codehighlighter1_860_1754_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_860_1754_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_860_1754_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_860_1754_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_860_1754_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_860_1754_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_860_1754_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_860_1754_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_860_1754_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_860_1754_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;conn&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlConnection(_connString))<br /></span><span style="color: #008080;">23</span><span style="color: #000000;"><img id="Codehighlighter1_944_1740_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_944_1740_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_944_1740_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_944_1740_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_944_1740_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_944_1740_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_944_1740_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_944_1740_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_944_1740_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_944_1740_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(conn.State&nbsp;</span><span style="color: #000000;">!=</span><span style="color: #000000;">&nbsp;System.Data.ConnectionState.Open)<br /></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conn.Open();<br /></span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;cmd&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;GetCachedCommand();<br /></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Parameters[</span><span style="color: #800080;">0</span><span style="color: #000000;">].Value&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;i;<br /></span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Connection&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;conn;<br /></span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;reader&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;cmd.ExecuteReader())<br /></span><span style="color: #008080;">31</span><span style="color: #000000;"><img id="Codehighlighter1_1279_1722_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1279_1722_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1279_1722_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1279_1722_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1279_1722_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1279_1722_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1279_1722_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1279_1722_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1279_1722_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1279_1722_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(reader.Read())<br /></span><span style="color: #008080;">33</span><span style="color: #000000;"><img id="Codehighlighter1_1348_1700_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1348_1700_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1348_1700_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1348_1700_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1348_1700_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1348_1700_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1348_1700_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1348_1700_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1348_1700_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1348_1700_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;product&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;Product<br /></span><span style="color: #008080;">35</span><span style="color: #000000;"><img id="Codehighlighter1_1450_1673_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1450_1673_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1450_1673_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1450_1673_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1450_1673_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1450_1673_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1450_1673_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1450_1673_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1450_1673_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1450_1673_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProductID&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">int</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">]),<br /></span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">string</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">Name</span><span style="color: #800000;">"</span><span style="color: #000000;">])<br /></span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;">;<br /></span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">42</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">44</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">45</span><span style="color: #000000;"><img id="Codehighlighter1_1774_1988_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1774_1988_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1774_1988_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1774_1988_Open_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1774_1988_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1774_1988_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1774_1988_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1774_1988_Closed_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1774_1988_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff;">ITest&nbsp;Members</span><span id="Codehighlighter1_1774_1988_Open_Text" style="display: none;"><span style="color: #0000ff;">#region</span><span style="color: #000000;">&nbsp;ITest&nbsp;Members</span><span style="color: #000000;"><br /></span><span style="color: #008080;">46</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">47</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Prepare()<br /></span><span style="color: #008080;">48</span><span style="color: #000000;"><img id="Codehighlighter1_1835_1872_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1835_1872_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1835_1872_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1835_1872_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1835_1872_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1835_1872_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1835_1872_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1835_1872_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1835_1872_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1835_1872_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">49</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(</span><span style="color: #800080;">1</span><span style="color: #000000;">);<br /></span><span style="color: #008080;">50</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">51</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">52</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Execute()<br /></span><span style="color: #008080;">53</span><span style="color: #000000;"><img id="Codehighlighter1_1912_1968_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1912_1968_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1912_1968_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1912_1968_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1912_1968_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1912_1968_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1912_1968_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1912_1968_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1912_1968_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1912_1968_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">54</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(Constants.RepeatTime);<br /></span><span style="color: #008080;">55</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">56</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">57</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">#endregion</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">58</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">59</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span></div><p>&nbsp;</p><div class="cnblogs_code"><img id="Code_Closed_Image_013904" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013904').style.display='none'; document.getElementById('Code_Open_Image_013904').style.display='inline'; document.getElementById('Code_Open_Text_013904').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" height="16"><img id="Code_Open_Image_013904" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013904').style.display='none'; getElementById('Code_Closed_Image_013904').style.display='inline'; getElementById('Code_Closed_Text_013904').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" height="16"><span id="Code_Closed_Text_013904" class="cnblogs_code_Collapse">LinqToSqlTest.cs</span><span id="Code_Open_Text_013904" style="display: none;"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;LinqToSqlTest&nbsp;:&nbsp;ITest<br /></span><span style="color: #008080;">&nbsp;2</span><span style="color: #000000;"><img id="Codehighlighter1_36_921_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_36_921_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_36_921_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_36_921_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_36_921_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_36_921_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_36_921_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_36_921_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_36_921_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_36_921_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">readonly</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;_connString&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ConfigurationManager.ConnectionStrings[Constants.ConnectingStringName].ConnectionString;<br /></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;DoExecute(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;repeatTime)<br /></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img id="Codehighlighter1_236_691_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_236_691_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_236_691_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_236_691_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_236_691_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_236_691_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_236_691_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_236_691_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_236_691_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_236_691_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(var&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #800080;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;repeatTime;&nbsp;</span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br /></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img id="Codehighlighter1_300_681_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_300_681_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_300_681_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_300_681_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_300_681_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_300_681_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_300_681_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_300_681_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_300_681_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_300_681_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;conn&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlConnection(_connString))<br /></span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="Codehighlighter1_384_667_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_384_667_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_384_667_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_384_667_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_384_667_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_384_667_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_384_667_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_384_667_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_384_667_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_384_667_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(conn.State&nbsp;</span><span style="color: #000000;">!=</span><span style="color: #000000;">&nbsp;System.Data.ConnectionState.Open)<br /></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conn.Open();<br /></span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;ctx&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;AdventureWorksDataContext(conn);<br /></span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;product&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ctx.Products.SingleOrDefault(p&nbsp;</span><span style="color: #000000;">=&gt;</span><span style="color: #000000;">&nbsp;p.ProductID&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;i);<br /></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">20</span><span style="color: #000000;"><img id="Codehighlighter1_701_915_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_701_915_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_701_915_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_701_915_Open_Text').style.display='inline';" align="top"><img id="Codehighlighter1_701_915_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_701_915_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_701_915_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_701_915_Closed_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_701_915_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff;">ITest&nbsp;Members</span><span id="Codehighlighter1_701_915_Open_Text" style="display: none;"><span style="color: #0000ff;">#region</span><span style="color: #000000;">&nbsp;ITest&nbsp;Members</span><span style="color: #000000;"><br /></span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Prepare()<br /></span><span style="color: #008080;">23</span><span style="color: #000000;"><img id="Codehighlighter1_762_799_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_762_799_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_762_799_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_762_799_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_762_799_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_762_799_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_762_799_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_762_799_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_762_799_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_762_799_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(</span><span style="color: #800080;">1</span><span style="color: #000000;">);<br /></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Execute()<br /></span><span style="color: #008080;">28</span><span style="color: #000000;"><img id="Codehighlighter1_839_895_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_839_895_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_839_895_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_839_895_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_839_895_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_839_895_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_839_895_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_839_895_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_839_895_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_839_895_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(Constants.RepeatTime);<br /></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">#endregion</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span></div><p>&nbsp;</p><div class="cnblogs_code"><img id="Code_Closed_Image_013929" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013929').style.display='none'; document.getElementById('Code_Open_Image_013929').style.display='inline'; document.getElementById('Code_Open_Text_013929').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" height="16"><img id="Code_Open_Image_013929" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013929').style.display='none'; getElementById('Code_Closed_Image_013929').style.display='inline'; getElementById('Code_Closed_Text_013929').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" height="16"><span id="Code_Closed_Text_013929" class="cnblogs_code_Collapse">LinqToSqlCompiledQueryTest.cs</span><span id="Code_Open_Text_013929" style="display: none;"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;LinqToSqlCompiledQueryTest&nbsp;:&nbsp;ITest<br /></span><span style="color: #008080;">&nbsp;2</span><span style="color: #000000;"><img id="Codehighlighter1_49_1064_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_49_1064_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_49_1064_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_49_1064_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_49_1064_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_49_1064_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_49_1064_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_49_1064_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_49_1064_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_49_1064_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">readonly</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;_connString&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ConfigurationManager.ConnectionStrings[Constants.ConnectingStringName].ConnectionString;<br /></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;DoExecute(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;repeatTime)<br /></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img id="Codehighlighter1_249_834_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_249_834_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_249_834_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_249_834_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_249_834_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_249_834_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_249_834_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_249_834_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_249_834_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_249_834_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;query&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;CompiledQuery.Compile((AdventureWorksDataContext&nbsp;ctx,&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;index)&nbsp;<br /></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">=&gt;</span><span style="color: #000000;">&nbsp;ctx.Products.SingleOrDefault(p&nbsp;</span><span style="color: #000000;">=&gt;</span><span style="color: #000000;">&nbsp;p.ProductID&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;index));<br /></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(var&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #800080;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;repeatTime;&nbsp;</span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br /></span><span style="color: #008080;">11</span><span style="color: #000000;"><img id="Codehighlighter1_481_824_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_481_824_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_481_824_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_481_824_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_481_824_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_481_824_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_481_824_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_481_824_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_481_824_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_481_824_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;conn&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlConnection(_connString))<br /></span><span style="color: #008080;">13</span><span style="color: #000000;"><img id="Codehighlighter1_565_810_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_565_810_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_565_810_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_565_810_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_565_810_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_565_810_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_565_810_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_565_810_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_565_810_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_565_810_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(conn.State&nbsp;</span><span style="color: #000000;">!=</span><span style="color: #000000;">&nbsp;System.Data.ConnectionState.Open)<br /></span><span style="color: #008080;">15</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conn.Open();<br /></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">17</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;ctx&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;AdventureWorksDataContext(conn);<br /></span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;product&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;query(ctx,&nbsp;i);<br /></span><span style="color: #008080;">19</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">23</span><span style="color: #000000;"><img id="Codehighlighter1_844_1058_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_844_1058_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_844_1058_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_844_1058_Open_Text').style.display='inline';" align="top"><img id="Codehighlighter1_844_1058_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_844_1058_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_844_1058_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_844_1058_Closed_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_844_1058_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff;">ITest&nbsp;Members</span><span id="Codehighlighter1_844_1058_Open_Text" style="display: none;"><span style="color: #0000ff;">#region</span><span style="color: #000000;">&nbsp;ITest&nbsp;Members</span><span style="color: #000000;"><br /></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Prepare()<br /></span><span style="color: #008080;">26</span><span style="color: #000000;"><img id="Codehighlighter1_905_942_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_905_942_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_905_942_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_905_942_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_905_942_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_905_942_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_905_942_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_905_942_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_905_942_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_905_942_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(</span><span style="color: #800080;">1</span><span style="color: #000000;">);<br /></span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">29</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Execute()<br /></span><span style="color: #008080;">31</span><span style="color: #000000;"><img id="Codehighlighter1_982_1038_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_982_1038_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_982_1038_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_982_1038_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_982_1038_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_982_1038_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_982_1038_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_982_1038_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_982_1038_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_982_1038_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">32</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(Constants.RepeatTime);<br /></span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">#endregion</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">37</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span></div><p><br /></p><div class="cnblogs_code"><img id="Code_Closed_Image_013959" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_013959').style.display='none'; document.getElementById('Code_Open_Image_013959').style.display='inline'; document.getElementById('Code_Open_Text_013959').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" height="16"><img id="Code_Open_Image_013959" style="display: none;" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_013959').style.display='none'; getElementById('Code_Closed_Image_013959').style.display='inline'; getElementById('Code_Closed_Text_013959').style.display='inline';" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" height="16"><span id="Code_Closed_Text_013959" class="cnblogs_code_Collapse">NIntegrateQueryTest.cs</span><span id="Code_Open_Text_013959" style="display: none;"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">class</span><span style="color: #000000;">&nbsp;NIntegrateQueryTest&nbsp;:&nbsp;ITest<br /></span><span style="color: #008080;">&nbsp;2</span><span style="color: #000000;"><img id="Codehighlighter1_42_1379_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_42_1379_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_42_1379_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_42_1379_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_42_1379_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_42_1379_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_42_1379_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_42_1379_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_42_1379_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_42_1379_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;3</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">static</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">readonly</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">string</span><span style="color: #000000;">&nbsp;_connString&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;ConfigurationManager.ConnectionStrings[Constants.ConnectingStringName].ConnectionString;<br /></span><span style="color: #008080;">&nbsp;4</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">&nbsp;5</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">private</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;DoExecute(</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;repeatTime)<br /></span><span style="color: #008080;">&nbsp;6</span><span style="color: #000000;"><img id="Codehighlighter1_242_1149_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_242_1149_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_242_1149_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_242_1149_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_242_1149_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_242_1149_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_242_1149_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_242_1149_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_242_1149_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_242_1149_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;7</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">for</span><span style="color: #000000;">&nbsp;(var&nbsp;i&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #800080;">1</span><span style="color: #000000;">;&nbsp;i&nbsp;</span><span style="color: #000000;">&lt;=</span><span style="color: #000000;">&nbsp;repeatTime;&nbsp;</span><span style="color: #000000;">++</span><span style="color: #000000;">i)<br /></span><span style="color: #008080;">&nbsp;8</span><span style="color: #000000;"><img id="Codehighlighter1_306_1139_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_306_1139_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_306_1139_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_306_1139_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_306_1139_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_306_1139_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_306_1139_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_306_1139_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_306_1139_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_306_1139_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">&nbsp;9</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;criteria&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;ProductCriteria();<br /></span><span style="color: #008080;">10</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;cmd&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;QueryCommandFactory(criteria.And(criteria.ProductID&nbsp;</span><span style="color: #000000;">==</span><span style="color: #000000;">&nbsp;i))<br /></span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.GetQueryCommand();<br /></span><span style="color: #008080;">12</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Parameters.Add(</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;SqlParameter(</span><span style="color: #800000;">"</span><span style="color: #800000;">@ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">,&nbsp;i));<br /></span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Connection.Open();<br /></span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">using</span><span style="color: #000000;">&nbsp;(var&nbsp;reader&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;cmd.ExecuteReader())<br /></span><span style="color: #008080;">15</span><span style="color: #000000;"><img id="Codehighlighter1_674_1125_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_674_1125_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_674_1125_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_674_1125_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_674_1125_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_674_1125_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_674_1125_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_674_1125_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_674_1125_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_674_1125_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">16</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">if</span><span style="color: #000000;">&nbsp;(reader.Read())<br /></span><span style="color: #008080;">17</span><span style="color: #000000;"><img id="Codehighlighter1_735_1063_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_735_1063_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_735_1063_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_735_1063_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_735_1063_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_735_1063_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_735_1063_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_735_1063_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_735_1063_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_735_1063_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">18</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;product&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">new</span><span style="color: #000000;">&nbsp;Product<br /></span><span style="color: #008080;">19</span><span style="color: #000000;"><img id="Codehighlighter1_829_1040_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_829_1040_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_829_1040_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_829_1040_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_829_1040_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_829_1040_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_829_1040_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_829_1040_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_829_1040_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_829_1040_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">20</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ProductID&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">int</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">ProductID</span><span style="color: #800000;">"</span><span style="color: #000000;">]),<br /></span><span style="color: #008080;">21</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;</span><span style="color: #000000;">=</span><span style="color: #000000;">&nbsp;((</span><span style="color: #0000ff;">string</span><span style="color: #000000;">)&nbsp;reader[</span><span style="color: #800000;">"</span><span style="color: #800000;">Name</span><span style="color: #800000;">"</span><span style="color: #000000;">])<br /></span><span style="color: #008080;">22</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;">;<br /></span><span style="color: #008080;">23</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">24</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd.Connection.Close();<br /></span><span style="color: #008080;">25</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">26</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">27</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">28</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">29</span><span style="color: #000000;"><img id="Codehighlighter1_1159_1373_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1159_1373_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1159_1373_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1159_1373_Open_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1159_1373_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1159_1373_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1159_1373_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1159_1373_Closed_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1159_1373_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff;">ITest&nbsp;Members</span><span id="Codehighlighter1_1159_1373_Open_Text" style="display: none;"><span style="color: #0000ff;">#region</span><span style="color: #000000;">&nbsp;ITest&nbsp;Members</span><span style="color: #000000;"><br /></span><span style="color: #008080;">30</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">31</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Prepare()<br /></span><span style="color: #008080;">32</span><span style="color: #000000;"><img id="Codehighlighter1_1220_1257_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1220_1257_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1220_1257_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1220_1257_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1220_1257_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1220_1257_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1220_1257_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1220_1257_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1220_1257_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1220_1257_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">33</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(</span><span style="color: #800080;">1</span><span style="color: #000000;">);<br /></span><span style="color: #008080;">34</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">35</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">36</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">public</span><span style="color: #000000;">&nbsp;</span><span style="color: #0000ff;">void</span><span style="color: #000000;">&nbsp;Execute()<br /></span><span style="color: #008080;">37</span><span style="color: #000000;"><img id="Codehighlighter1_1297_1353_Open_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1297_1353_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_1297_1353_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_1297_1353_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_1297_1353_Closed_Image" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_1297_1353_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_1297_1353_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_1297_1353_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_1297_1353_Closed_Text" style="border: 1px solid #808080; background-color: #ffffff; display: none;"><img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_1297_1353_Open_Text"><span style="color: #000000;">{<br /></span><span style="color: #008080;">38</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoExecute(Constants.RepeatTime);<br /></span><span style="color: #008080;">39</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">40</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif" align="top"  alt="" /><br /></span><span style="color: #008080;">41</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff;">#endregion</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">42</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000;"><br /></span><span style="color: #008080;">43</span><span style="color: #000000;"><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span></div><p><br /></p><h3>测试结果分析</h3> <ol> <li>在不使用CompiledQuery的情况下，LinqToSql的性能比AdoNet差一个数量级，用百分比的话就是慢超过1000%；</li> <li>在缓存Command的情况下，AdoNet的查询性能可以提高约30%；</li> <li>在使用CompiledQuery的情况下，LinqToSql的查询性能比缓存Command的AdoNet下慢50%；</li> <li>NIntegrqateQuery的查询性能和不带缓存的AdoNet查询性能相当，比LinqToSqlCompiledQuery快约40%;</li></ol> <p>* 如对测试结果有任何异议，欢迎根跟贴友好讨论。</p> <p><strong>什么是NIntegrateQuery？</strong> </p><ol> <li>NIntegrateQuery是Teddy最新开发的开源组件<a href="http://nintegrate.com/"><span style="color: #0000ff;">NIntegrate</span></a>的一部分。</li> <li>NIntegrate是一个企业级系统集成开发框架。它的核心设计思想是，提供一个基于数据库集中化管理WCF服务配置信息和应用程序配置信息的方案，从而使得基于WCF的企业级SOA系统集成真正成为可能。</li> <li>NIntegrateQuery是一个类似Linq的强类型数据库查询语言。它的设计目标并不是ORM，也当然不是重新发明一个类似LinqToSql的轮子。它的设计目标是一个安全（完全防范SQL注入攻击）、高性能（参见测试结果），所有查询对象可以跨WCF、跨COM传递，并且支持动态查询条件、分页、排序的数据库查询语言。因为这个设计目标，它目前不支持，作为NIntegrate的一个组件，将来也没有计划支持类似LinqToSql提供的join、group by这样的查询。如果您要做这样的查询，标准的做法是先建一个View，再对View进行查询。</li> <li>对于比较频繁的查询操作，虽然NIntegrateQuery本身的查询性能是非常好的，但是，如果可能，还是建议尽可能使用存储过程。</li> <li>对于所有的写操作，虽然NIntegrateQuery提供了一个基于DataAdapter.Update的简单实现，但是，出于性能考虑，原则上，建议使用存储过程，当然，您也可以选择同时使用包括LinqToSql在内的任意其他ORM组件。</li></ol>  <p><strong>NIntegrateQuery支持的其它功能还包括：</strong></p> <ol> <li>混合支持多数据库、不同类型数据库的查询（正式版本将至少支持：SQL Server, Oracle, DB2和MySql）。</li> <li>对不同的数据库，支持可扩展的，甚至是仅特定数据库支持的方法或语法。</li> <li>NIntegrate中包括了基于NIntegrateQuery的通用WCF查询服务的定义和默认实现，以及基于NIntegrateQuery和通用WCF查询服务的ASP.NET DataSource控件，方便进行数据绑定。</li></ol>  <h3>后记</h3> <p>这篇文章写完第一遍发布之前点预览时Firefox崩溃了，结果所有内容在Live Writer里老老实实重写了一遍，我哭~~~。为了避免同样的悲剧，我强烈建议您，千万不要在没有在其他地方备份前，在Firefox里点击FreeTextBox这个Rich Editor的&#8220;Preview&#8221;按钮。我是32bit Window Server 2008 + Firefox 3.0。切忌、切忌~~</p><p>&nbsp;</p><p><em>//我是结尾符</em></p><p>&nbsp;</p><img src="http://www.cnblogs.com/teddyma/aggbug/1497903.html?type=1" width="1" height="1" alt=""/><p>评论: 13　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/07/1497903.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/07/1497903.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>EF上海急招Flex Developer, 待遇从优,有意者请和我联系(人已招到,Closed)</title><link>http://www.cnblogs.com/teddyma/archive/2009/06/04/1495924.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Thu, 04 Jun 2009 02:41:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/06/04/1495924.html</guid><description><![CDATA[<p>阅读: 713 评论: 1 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-06-04 10:41 <a href="http://www.cnblogs.com/teddyma/archive/2009/06/04/1495924.html" target="_blank">原文链接</a></p><p>要求Flex3.0开发经验,ASP.NET前端开发经验，本科，英语至少CET4最好CET6以上。</p>
<div>
<table vspace="0" align="left" cellpadding="0" cellspacing="0" hspace="0">
    <tr>
        <td style="padding: 5pt 9pt;" valign="top" align="left">
        <p class="MsoNormal"><strong><u style="text-decoration: none;"><span style="font-size: 10pt; font-family: Verdana,sans-serif;" lang="EN-US">Main
        responsibilities</span></u></strong></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-align: justify; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Develop
        front end components (<u2:city u3:st="on"><u2:place u3:st="on">Ajax</u2:place></u2:city>,
        javascript, HTML etc.) of Englishtown&#8217;s web-site<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-align: justify; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Work
        on Flash/Flex coding <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-align: justify; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Help
        designers on graphic slicing (convert PSD files to HTML files with CSS) <o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 18pt; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <p class="MsoNormal" style="text-align: justify;"><strong><u style="text-decoration: none;"><span style="font-size: 10pt; font-family: Verdana,sans-serif;" lang="EN-US">Requirements</span></u></strong></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Rich
        experience in Flash/Flex, ActionScript3.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Experience
        in HTML, JavaScript and CSS.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Experience
        in Photoshop.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Solid
        coding skill on web-based application system with rich client experience.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><u2:city u3:st="on"><u2:place u3:st="on"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">AJAX</span></u2:place></u2:city>
        project experience is a plus.<o:p></o:p></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">1+
        year web application development and GUI design experience.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Good
        skills on Visual Studio .NET, client-side scripting, C#, VB.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Good
        skills on<span>&nbsp; </span>XML, XSLT, Web Service ,SQL.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Familiarity
        with VML, SVG is a plus.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Fluency
        in English, both on speaking and writing.<o:p></o:p></span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Strong
        problem solving and troubleshooting skills.</span></p>
        <p class="MsoNormal" style="margin-left: 36pt; text-indent: -18pt;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">-</span><span style="font-size: 7pt;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;" lang="EN-US">Self-Learning
        capability.</span></p>
        </td>
    </tr>
</table>
</div>
<p>&nbsp;</p><img src="http://www.cnblogs.com/teddyma/aggbug/1495924.html?type=1" width="1" height="1" alt=""/><p>评论: 1　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/04/1495924.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/06/04/1495924.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>提前发布4/25上海俱乐部活动演讲“集中化WCF服务配置管理”示例程序</title><link>http://www.cnblogs.com/teddyma/archive/2009/04/21/1440086.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Mon, 20 Apr 2009 16:45:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/04/21/1440086.html</guid><description><![CDATA[<p>阅读: 2279 评论: 5 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-04-21 00:45 <a href="http://www.cnblogs.com/teddyma/archive/2009/04/21/1440086.html" target="_blank">原文链接</a></p><p>承蒙<a href="http://www.cnblogs.com/tonyqus/archive/2009/04/15/1436144.html" target="_blank"></a><span style="color: #0000ff;"><a href="http://www.cnblogs.com/tonyqus/archive/2009/04/15/1436144.html" target="_blank">4/25上海俱乐部活动</a></span>组织团队邀请，本人有幸将在本次活动中和大家分享一下&#8220;集中化WCF服务配置管理&#8221;方面的一些探索。为了让大家对活动当天我讲的话题提前有一个更直观的了解，在这里提前介绍一下到时我会演示的示例程序。</p> <p><br /></p> <p><strong>本示例程序具体演示如下内容：</strong></p> <p>1) 基于SQL Server数据库的集中化WCF服务配置管理; </p> <p>2) 集中化ConnectingString管理; </p> <p>3) 集中化AppVariable管理; </p> <p>4) 基于集中化配置管理的WCF ServiceHostFactory和WCF ServiceLocator; </p> <p>5) 基于集中化配置管理的跨WCF的LINQ Style分页、排序查询及DataSource控件的使用; </p> <p>6) 整合本地ServiceLocator的WCF服务发布和消费;</p> <p><br /></p> <p><strong>下载地址(请使用SVN客户端下载)：</strong></p> <p><a target="_blank" style="color: #0000ff;" title="http://nintegrate.googlecode.com/svn/trunk/" href="http://nintegrate.googlecode.com/svn/trunk/">http://nintegrate.googlecode.com/svn/trunk/</a></p> <p><br /></p> <p><strong>安装说明：</strong></p> <p>请先使用SVN客户端下载所有代码，然后根据samples\setup目录中的readme.txt初始化配置数据库并打开示例的solution。要运行本示例，您需要至少安装了IIS6，VS2008和SQL Server 2005或2008或Express。如果要运行Net.Tcp Binding的演示，需要IIS7。</p> <p><br /></p> <p><strong>示例工程：</strong></p> <p>本示例程序由下面四个C#工程项目组成：</p> <p>1. SimpleServiceContracts - 定义了ServiceContracts和DataContracts</p> <p>2. SimpleServiceImpls - 包含了ServiceContracts的实现类</p> <p>3. SimpleServiceProvider &#8211; 服务发布Web程序</p> <p>4. SimpleServiceConsumer - 服务消费Web程序</p> <p>这四个示例工程又分别依赖于由NIntegrate, NIntegrate.Query, NIntegrate.Query.Command和NIntegrate.Web这四个工程组成的名为NIntegrate的基于WCF和集中化配置的SOA框架(关于这个框架的更多内容，Teddy的博客以后会有更多介绍，这里让我们还是先关注示例程序本身)。</p> <p><br /></p> <h3>SimpleServiceProvider程序</h3> <p>本程序使用IIS发布了两个WCF服务QueryService.svc和SimpleService.svc。这两个.svc文件的内容如下：</p> <p>QueryService.svc - NIntegrate查询服务，由NIntegrate内置实现</p> <div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">1</span>&nbsp;<span style="background-color: #ffff00; color: #000000;">&lt;%</span><span style="background-color: #f5f5f5; color: #000000;">@&nbsp;ServiceHost&nbsp;Service</span><span style="background-color: #f5f5f5; color: #000000;">=</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #800000;">NIntegrate.Query.IQueryService,&nbsp;NIntegrate.Query,&nbsp;Version=0.5.0.1,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=e2b9e2165dbdd5e6</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #000000;">&nbsp;Factory</span><span style="background-color: #f5f5f5; color: #000000;">=</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #800000;">NIntegrate.WcfServiceHostFactory,&nbsp;NIntegrate,&nbsp;Version=0.5.0.1,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=e2b9e2165dbdd5e6</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #000000;">&nbsp;</span><span style="background-color: #ffff00; color: #000000;">%&gt;</span></div><p>&nbsp;</p><p>SimpleService.svc - 一个简单的SayHello服务，用于演示集中化配置的多Binding，多Endpoint的WCF服务发布和消费</p> <div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">1</span>&nbsp;<span style="background-color: #ffff00; color: #000000;">&lt;%</span><span style="background-color: #f5f5f5; color: #000000;">@&nbsp;ServiceHost&nbsp;Service</span><span style="background-color: #f5f5f5; color: #000000;">=</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #800000;">SimpleServiceContracts.ISimpleServiceDemo,&nbsp;SimpleServiceContracts</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #000000;">&nbsp;Factory</span><span style="background-color: #f5f5f5; color: #000000;">=</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #800000;">NIntegrate.WcfServiceHostFactory,&nbsp;NIntegrate,&nbsp;Version=0.5.0.1,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=e2b9e2165dbdd5e6</span><span style="background-color: #f5f5f5; color: #800000;">"</span><span style="background-color: #f5f5f5; color: #000000;">&nbsp;</span><span style="background-color: #ffff00; color: #000000;">%&gt;</span></div><p>&nbsp; </p><p><strong>这里值得注意的有两点：</strong></p> <p>1. 这两个服务的Service指定的是服务的ServiceContract接口类型而非服务的具体实现类。</p> <p>2. 这两个服务通过由NIntegrate实现的WcfServiceHostFactory自动通过指定的ServiceContract接口类型和基于SQL Server的集中化配置数据库创建相应的ServiceHost，并发布服务。</p> <p>&nbsp;</p> <p><strong>解析：</strong></p> <p>WcfServiceHostFactory在内部是如何通过指定的ServiceContract接口类型找到具体的实现类的呢？是通过一个可在Web.config中配置的本地ServiceLocator实现的。NIntegrate内置实现了一个基于SQL Server数据库集中化配置的AppVariableServiceLocator，并提供了方便的接口可以和第三方的ServiceLocator，如Unity，Castle这样的IoC容器进行整合来自动定位接口的实现。在本示例中，ServiceContract接口类型对应的服务实现类，是通过数据库中的AppVariable表进行映射，并使用AppVariableServiceLocator类进行定位的。</p> <p>&nbsp;</p> <p>在SimpleServiceProvider的Web.config中，只需要设置一个AppCode和一个ConnectionString，无需任何WCF配置信息：<br /></p><div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">&nbsp;1</span>&nbsp;<span style="color: #000000;">&#8230;<br /></span><span style="color: #008080;">&nbsp;2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">appSettings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;3</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">add&nbsp;</span><span style="color: #ff0000;">key</span><span style="color: #0000ff;">="NIntegrate.Configuration.AppCode"</span><span style="color: #ff0000;">&nbsp;value</span><span style="color: #0000ff;">="SP_SSP"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;4</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #008000;">&lt;!--</span><span style="color: #008000;">To&nbsp;set&nbsp;service&nbsp;locator&nbsp;wrapper&nbsp;for&nbsp;external&nbsp;IoC&nbsp;container&nbsp;here,&nbsp;by&nbsp;default,&nbsp;the&nbsp;build-in&nbsp;AppVariableServiceLocator&nbsp;is&nbsp;used.</span><span style="color: #008000;">--&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;5</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #008000;">&lt;!--</span><span style="color: #008000;">&lt;add&nbsp;key="NIntegrate.ExternalServiceLocator"&nbsp;value="NIntegrate.AppVariableServiceLocator,&nbsp;NIntegrate,&nbsp;Version=0.5.0.1,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=e2b9e2165dbdd5e6"/&gt;</span><span style="color: #008000;">--&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;6</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">appSettings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;7</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">connectionStrings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;8</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">add&nbsp;</span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="NIntegrate.Configuration"</span><span style="color: #ff0000;">&nbsp;connectionString</span><span style="color: #0000ff;">="Data&nbsp;Source=vista;Initial&nbsp;Catalog=NIntegrateDemo;Persist&nbsp;Security&nbsp;Info=True;User&nbsp;ID=nbear;Password=nbear"</span><span style="color: #ff0000;">&nbsp;providerName</span><span style="color: #0000ff;">="System.Data.SqlClient"</span><span style="color: #ff0000;">&nbsp;</span><span style="color: #0000ff;">/&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">&nbsp;9</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">connectionStrings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">10</span>&nbsp;<span style="color: #000000;">&#8230;</span></div><p>&nbsp;</p> <h3>SimpleServiceConsumer程序</h3> <p>本程序也是一个部署在IIS下的Web程序，它只包含一个Default.aspx页面和一个Web.config文件。</p>  <p>他的Web.config和SimpleServiceProvider的Web.config一样，只需要设置一个AppCode和一个ConnectringString：<br /></p><div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080;">1</span>&nbsp;<span style="color: #000000;">&#8230;<br /></span><span style="color: #008080;">2</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">appSettings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">3</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">add&nbsp;</span><span style="color: #ff0000;">key</span><span style="color: #0000ff;">="NIntegrate.Configuration.AppCode"</span><span style="color: #ff0000;">&nbsp;value</span><span style="color: #0000ff;">="SP_SSC"</span><span style="color: #0000ff;">/&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">4</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">appSettings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">5</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">connectionStrings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">6</span>&nbsp;<span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">add&nbsp;</span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="NIntegrate.Configuration"</span><span style="color: #ff0000;">&nbsp;connectionString</span><span style="color: #0000ff;">="Data&nbsp;Source=vista;Initial&nbsp;Catalog=NIntegrateDemo;Persist&nbsp;Security&nbsp;Info=True;User&nbsp;ID=nbear;Password=nbear"</span><span style="color: #ff0000;"><br /></span><span style="color: #008080;">7</span>&nbsp;<span style="color: #ff0000;">&nbsp;&nbsp;&nbsp;&nbsp;providerName</span><span style="color: #0000ff;">="System.Data.SqlClient"</span><span style="color: #0000ff;">/&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">8</span>&nbsp;<span style="color: #000000;"></span><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">connectionStrings</span><span style="color: #0000ff;">&gt;</span><span style="color: #000000;"><br /></span><span style="color: #008080;">9</span>&nbsp;<span style="color: #000000;">&#8230;</span></div> <p>&nbsp;</p><p>他的Default.aspx页面则演示了QueryService.svc和SimpleService.svc这两个Service的使用。运行Default.aspx页面的界面如下：</p> <p><a target="_blank" href="http://images.cnblogs.com/cnblogs_com/teddyma/WindowsLiveWriter/425WCF_13FC0/image_4.png"><img style="border: 0px none ; display: inline;" title="image" alt="image" src="http://images.cnblogs.com/cnblogs_com/teddyma/WindowsLiveWriter/425WCF_13FC0/image_thumb_1.png" border="0" width="640" height="274" /></a> </p> <p>从界面可以看到，这里有几个GridView可以排序和编辑QueryService和SimpleService的Binding和Endpoint，他们都是通过使用由NIntegrate提供的QueryDataSource控件基于QueryService.svc实现的。最后一行是SimpleService.svc的调用的输出和当前使用的WCF Binding类型。</p> <p><br /></p> <p>当前，QueryService和SimpleService都使用数据库中配置的&#8220;Sample - Shared Binding&#8221;这个Binding运行的，我们可以直接在GridView中修改Binding的类型和配置信息。修改Binding后，需要recycle IIS中的AppPool使新的配置生效。(注意，只有IIS7支持修改成非HTTP的Binding，并且要自己在IIS中启用相应的net.tcp或net.pipe Binding支持)。</p> <p><br /></p> <p>SimpleService有第二个名为&#8220;SimpleServiceDemo Binding 2&#8221;的NetTcpBinding，如果您使用的是IIS7，并且已经启用了IIS中的net.tcp Binding，可以点击Enable将它激活。recycle IIS中的AppPool并重行运行 Default.aspx的话，您将看到，最后一行的Binding Type变成&#8220;NetTcpBinding&#8221;。也就是说，如果一个Service有多个激活状态的不同类型的Endpoint，NIntegrate提供的ServiceManager会保证最优的Binding被使用。例如，这里SimpleService有WSHttp和NetTcp这两个Binding，当然NetTcp是最优的。更进一步。假如，这里还配置了本地ServiceLocator，并为SimpleService指定了对应的实现类，那么，您也可以猜到，&#8220;更优&#8221;的本地Service实现会被使用，而不会走WCF通道。</p> <p>&nbsp;</p>  <p>QueryDataSource控件又是如何通过QueryService.svc实现对Service, Binding和Endpoint这些配置信息的呈现、排序和修改的呢？事实上，QueryService提供的查询语法不仅支持简单的CRUD，还支持LINQ Style的查询语言，多种数据库支持，数据库特有的函数扩展和分页排序，并且查询语言可以跨WCF和COM兼容(也就是说，可以在非.NET应用程序如ASP中使用同样的LINQ Style查询语言访问WCF发布的服务远程进行同样的分页排序查询)。这里容我卖个关子，就不多介绍了。大家可以选择自己看代码(包括NIntegrate核心类库和本示例都是基于BSD协议公开全部源代码的)，来参加俱乐部活动和Teddy一起探讨或者等Teddy的博客将来专门的专题来介绍。</p> <p><br /></p> <p>好了就先介绍这么多了。有任何意见和建议欢迎通过各种渠道和Teddy交流。如果您来参加4/25的活动，当然更欢迎了。不过，我知道很多朋友周末打算去看上海车展的，没关系，顶顶这个帖子我也知足了。</p> <p><br /></p> <p><em>//我是结尾符</em></p><img src="http://www.cnblogs.com/teddyma/aggbug/1440086.html?type=1" width="1" height="1" alt=""/><p>评论: 5　<a href="http://www.cnblogs.com/teddyma/archive/2009/04/21/1440086.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/04/21/1440086.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>Apply SOA Design Patterns with WCF (5) WCF Based ASP.NET DataSouce Control (基于WCF的数据源控件)</title><link>http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Sun, 29 Mar 2009 16:03:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html</guid><description><![CDATA[<p>阅读: 1859 评论: 3 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-03-30 00:03 <a href="http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html" target="_blank">原文链接</a></p><p><strong>Original (原创) by Teddy’s Knowledge Base</strong></p> <h3>Content (目录)</h3> <p>(1) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/23/1419329.html">WCF Configuration Centralization (WCF配置集中管理)</a></font></p> <p>(2) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/25/1421892.html">WCF Automatic Deployment (WCF自动化部署) </a></font></p> <p>(3) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/26/1422776.html">WCF Automatic Service Locating (WCF自动化服务定位)</a></font></p> <p>(4) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html">WCF Database Paging &amp; Sorting (WCF数据库分页和排序)</a></font></p> <p>(5) <a href="http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html">WCF Based ASP.NET DataSouce Control (基于WCF的数据源控件)</a></p> <p>(6) <font color="#0000ff"><a href="http://code.google.com/p/nintegrate/">1 + 2 + 3 + 4 + 5 = ?</a></font></p> <p><b><font color="#0000ff"><strong><a href="http://www.dotnetjunkies.com/WebLog/teddy/archive/2009/03/29/589777.aspx" target="_blank">English Version</a></strong></font></b><br></p> <h3>摘要</h3> <p>本文介绍如何实现一个基于WCF的ASP.NET数据源控件,从而使得跨WCF通信的数据库CRUD,尤其是复杂的分页排序更简单。</p> <h3>正文</h3> <h4>我们需要基于WCF的ASP.NET数据源控件吗？</h4> <p>ASP.NET的数据源设计是的 ASP.NET页面上的数据绑定十分简单，但是.NET Framework到目前为止内置提供的DataSource控件，对WCF的支持都不是很方便。SqlDataSource和LinqDataSource暴露了太多SQL的细节，仅支持SQL Server数据库，并且完全不支持WCF；ObjectDataSOource则太通用了，以至于仅仅为了实现一个很简单的数据库分页排序功能也需要写很多代码。因此，如果我们基于WCF和ASP.NET来实现SOA，那么，一个基于WCF的ASP.NET数据源控件绝对值得去设计。</p> <h4>我们手头都有哪些武器了？</h4> <ul> <li>集中化的配置管理，参见<font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/23/1419329.html">文章(1)</a></font></li> <li>自动、透明的WCF服务发布和定位，参见<font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/25/1421892.html">文章(2)</a></font>和<font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/26/1422776.html">文章(3)</a></font></li> <li>一组可以跨WCF通信的查询类，参见<font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html">文章(4)</a></font></li></ul> <h4>实现</h4> <p>首先，我们可以定义一个为所有的查询共享的WCF服务契约。下面的代码是IQueryService服务契约：</p><blockquote><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">&nbsp;1</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[ServiceContract]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;2</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">interface</span><span style="color: rgb(0, 0, 0);">&nbsp;IQueryService<br></span><span style="color: rgb(0, 128, 128);">&nbsp;3</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;4</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OperationContract]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;5</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DataTable&nbsp;Select(Criteria&nbsp;criteria);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;6</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OperationContract]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;7</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;SelectCount(Criteria&nbsp;criteria);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;8</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[OperationContract]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;9</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(Criteria&nbsp;criteria,&nbsp;DataTable&nbsp;modifiedTable,&nbsp;ConflictOption&nbsp;conflictDetection);<br></span><span style="color: rgb(0, 128, 128);">10</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></blockquote><br><p>然后，我们可以为上面这个服务契约，定义一个基于查询对象的默认的实现： </p><blockquote><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">&nbsp;1</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">sealed</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryService&nbsp;:&nbsp;IQueryService<br></span><span style="color: rgb(0, 128, 128);">&nbsp;2</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;3</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;DataTable&nbsp;Select(Criteria&nbsp;criteria)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;4</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;5</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;6</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArgumentNullException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;7</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;8</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">using</span><span style="color: rgb(0, 0, 0);">&nbsp;(var&nbsp;adapter&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryCommandFactory(criteria).GetQueryDataAdapter())<br></span><span style="color: rgb(0, 128, 128);">&nbsp;9</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">10</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;connection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;adapter.SelectCommand.Connection;<br></span><span style="color: rgb(0, 128, 128);">11</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">12</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">13</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Open)<br></span><span style="color: rgb(0, 128, 128);">14</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Open();<br></span><span style="color: rgb(0, 128, 128);">15</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;table&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataTable(criteria._tableName);<br></span><span style="color: rgb(0, 128, 128);">16</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;adapter.Fill(table);<br></span><span style="color: rgb(0, 128, 128);">17</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;table;<br></span><span style="color: rgb(0, 128, 128);">18</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">19</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">finally</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">20</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">21</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Closed)<br></span><span style="color: rgb(0, 128, 128);">22</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Close();<br></span><span style="color: rgb(0, 128, 128);">23</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Dispose();<br></span><span style="color: rgb(0, 128, 128);">24</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">25</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">26</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">27</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">28</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;SelectCount(Criteria&nbsp;criteria)<br></span><span style="color: rgb(0, 128, 128);">29</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">30</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">31</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArgumentNullException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">32</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">33</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">using</span><span style="color: rgb(0, 0, 0);">&nbsp;(var&nbsp;cmd&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryCommandFactory(criteria).GetCountCommand())<br></span><span style="color: rgb(0, 128, 128);">34</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">35</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;connection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;cmd.Connection;<br></span><span style="color: rgb(0, 128, 128);">36</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">37</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">38</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Open)<br></span><span style="color: rgb(0, 128, 128);">39</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Open();<br></span><span style="color: rgb(0, 128, 128);">40</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;Convert.ToInt32(cmd.ExecuteScalar());<br></span><span style="color: rgb(0, 128, 128);">41</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">42</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">finally</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">43</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">44</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Closed)<br></span><span style="color: rgb(0, 128, 128);">45</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Close();<br></span><span style="color: rgb(0, 128, 128);">46</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Dispose();<br></span><span style="color: rgb(0, 128, 128);">47</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">48</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">49</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">50</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">51</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;Update(Criteria&nbsp;criteria,&nbsp;DataTable&nbsp;modifiedTable,&nbsp;ConflictOption&nbsp;conflictDetection)<br></span><span style="color: rgb(0, 128, 128);">52</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">53</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">54</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArgumentNullException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">55</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">56</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">using</span><span style="color: rgb(0, 0, 0);">&nbsp;(var&nbsp;adapter&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryCommandFactory(criteria).GetUpdatableQueryDataAdapter(conflictDetection))<br></span><span style="color: rgb(0, 128, 128);">57</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">58</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;connection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;adapter.SelectCommand.Connection;<br></span><span style="color: rgb(0, 128, 128);">59</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">60</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">61</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Open)<br></span><span style="color: rgb(0, 128, 128);">62</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Open();<br></span><span style="color: rgb(0, 128, 128);">63</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;adapter.Update(modifiedTable);<br></span><span style="color: rgb(0, 128, 128);">64</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">65</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">finally</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">66</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">67</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(connection.State&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConnectionState.Closed)<br></span><span style="color: rgb(0, 128, 128);">68</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Close();<br></span><span style="color: rgb(0, 128, 128);">69</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connection.Dispose();<br></span><span style="color: rgb(0, 128, 128);">70</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">71</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">72</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">73</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><br></blockquote> <p>最后，只要通过能和第三方服务定位器整合的ServiceManager类，参见<font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/26/1422776.html">文章(3)</a></font>，如果我们能实现一个带一个Criteria属性作为查询的输入的数据源控件，我们就能很容易的基于能自动化的定位的IQueryService服务的实现CRUD。要实现一个自定义的自定义的数据源控件，可以参考.NET Framework中的SqlDataSource控件的实现，下面的代码是这个基于WCF的QueryDataSource控件的实现摘要： </p><blockquote><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;1</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">sealed</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryDataSource&nbsp;:&nbsp;DataSourceControl<br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;2</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;3</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Private&nbsp;Fields</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;4</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;5</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;6</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;7</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;8</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;&nbsp;9</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Protected&nbsp;Methods</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;10</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;11</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;DataSourceView&nbsp;GetView(</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">&nbsp;viewName)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;12</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;13</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_view&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;14</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_view&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryDataSourceView(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;15</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;_view;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;16</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;17</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;18</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;OnInit(System.EventArgs&nbsp;e)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;19</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;20</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">base</span><span style="color: rgb(0, 0, 0);">.OnInit(e);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;21</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;22</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(HttpContext.Current&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;23</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;24</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">UseLocalQueryService)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;25</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;26</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_locator&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ServiceManager.GetServiceLocator(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(IQueryService));<br></span><span style="color: rgb(0, 128, 128);">&nbsp;27</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_service&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_locator.GetService</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">IQueryService</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">();<br></span><span style="color: rgb(0, 128, 128);">&nbsp;28</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;29</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;30</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;31</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;serviceType&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;Type.GetType(_defaultQueryServiceImplType);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;32</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_service&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;(IQueryService)Activator.CreateInstance(serviceType);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;33</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_service&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;34</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;FileLoadException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Could&nbsp;not&nbsp;load&nbsp;assembly&nbsp;-&nbsp;NIntegrate.Query.Command.dll.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;35</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;36</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;37</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;38</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;39</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;40</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Public&nbsp;Properties</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;41</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;42</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Category(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Data</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">),&nbsp;DefaultValue(</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">),&nbsp;Description(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">When&nbsp;the&nbsp;value&nbsp;of&nbsp;this&nbsp;property&nbsp;equals&nbsp;true,&nbsp;it&nbsp;always&nbsp;using&nbsp;NIntegrate.Query.Command.QueryService&nbsp;class&nbsp;as&nbsp;QueryService&nbsp;insteads&nbsp;of&nbsp;trying&nbsp;to&nbsp;get&nbsp;the&nbsp;IQueryService&nbsp;implementation&nbsp;instance&nbsp;from&nbsp;ServiceManager&nbsp;class.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;43</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;UseLocalQueryService&nbsp;{&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);">;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;44</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;45</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Category(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Data</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">),&nbsp;Description(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Specify&nbsp;the&nbsp;criteria.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;46</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;Criteria&nbsp;Criteria<br></span><span style="color: rgb(0, 128, 128);">&nbsp;47</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;48</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">internal</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;49</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;50</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);">&nbsp;EnableViewState<br></span><span style="color: rgb(0, 128, 128);">&nbsp;51</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);">&nbsp;ViewState[</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">]&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;52</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;53</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryHelper.CriteriaDeserialize(<br></span><span style="color: rgb(0, 128, 128);">&nbsp;54</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">)ViewState[</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">]);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;55</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;56</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;57</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;_criteria;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;58</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;59</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">set</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;60</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;61</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(value&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;62</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;63</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;64</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;value;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;65</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(EnableViewState)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;66</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ViewState[</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Criteria</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">]&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryHelper.CriteriaSerialize(value.ToBaseCriteria());<br></span><span style="color: rgb(0, 128, 128);">&nbsp;67</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;68</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;69</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;70</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;71</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;72</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;73</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;74</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Events</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;75</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;76</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;77</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;78</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;79</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;80</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Dispose()</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;81</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;82</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Dispose()<br></span><span style="color: rgb(0, 128, 128);">&nbsp;83</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;84</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dispose(</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;85</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GC.SuppressFinalize(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;86</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;87</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;88</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;disposed;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;89</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;90</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);">&nbsp;Dispose(</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;disposing)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;91</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;92</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(disposed)&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;93</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(disposing)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;94</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;95</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;dispose&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_service&nbsp;</span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);">&nbsp;IDisposable;<br></span><span style="color: rgb(0, 128, 128);">&nbsp;96</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(dispose&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;97</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dispose.Dispose();<br></span><span style="color: rgb(0, 128, 128);">&nbsp;98</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_locator&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;99</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_locator.Dispose();<br></span><span style="color: rgb(0, 128, 128);">100</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">101</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">102</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disposed&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">103</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">104</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">105</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 0);">~</span><span style="color: rgb(0, 0, 0);">QueryDataSource()<br></span><span style="color: rgb(0, 128, 128);">106</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">107</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dispose(</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">108</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">109</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">110</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">111</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">112</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">113</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">internal</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">sealed</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryDataSourceView&nbsp;:&nbsp;DataSourceView<br></span><span style="color: rgb(0, 128, 128);">114</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">115</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Private&nbsp;Membes</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">116</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">117</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">118</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">119</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">120</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">121</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Constructors</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">122</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">123</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">internal</span><span style="color: rgb(0, 0, 0);">&nbsp;QueryDataSourceView(QueryDataSource&nbsp;owner)<br></span><span style="color: rgb(0, 128, 128);">124</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="color: rgb(0, 0, 255);">base</span><span style="color: rgb(0, 0, 0);">(owner,&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Default</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">125</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">126</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(owner&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">127</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ArgumentNullException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">owner</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">128</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">129</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_owner&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;owner;<br></span><span style="color: rgb(0, 128, 128);">130</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">131</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">132</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">133</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">134</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Public&nbsp;Properties</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">135</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">136</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanInsert<br></span><span style="color: rgb(0, 128, 128);">137</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">138</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">139</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">140</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">141</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">142</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">143</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">144</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanUpdate<br></span><span style="color: rgb(0, 128, 128);">145</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">146</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">147</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">148</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">149</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">150</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">151</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">152</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanDelete<br></span><span style="color: rgb(0, 128, 128);">153</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">154</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">155</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">156</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">157</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">158</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">159</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">160</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanRetrieveTotalRowCount<br></span><span style="color: rgb(0, 128, 128);">161</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">162</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">163</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">164</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">165</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">166</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">167</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">168</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanPage<br></span><span style="color: rgb(0, 128, 128);">169</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">170</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">171</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">172</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">173</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">174</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">175</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">176</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">bool</span><span style="color: rgb(0, 0, 0);">&nbsp;CanSort<br></span><span style="color: rgb(0, 128, 128);">177</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">178</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">179</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">180</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br></span><span style="color: rgb(0, 128, 128);">181</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">182</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">183</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">184</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">185</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">186</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#region</span><span style="color: rgb(0, 0, 0);">&nbsp;Protected&nbsp;Methods</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">187</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">188</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;ExecuteInsert(IDictionary&nbsp;values)<br></span><span style="color: rgb(0, 128, 128);">189</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">190</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">191</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">192</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;table&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Select(criteria);<br></span><span style="color: rgb(0, 128, 128);">193</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;row&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;table.NewRow();<br></span><span style="color: rgb(0, 128, 128);">194</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;en&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;values.GetEnumerator();<br></span><span style="color: rgb(0, 128, 128);">195</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">&nbsp;(en.MoveNext())<br></span><span style="color: rgb(0, 128, 128);">196</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">197</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table.Columns.Contains(en.Key.ToString()))<br></span><span style="color: rgb(0, 128, 128);">198</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[en.Key.ToString()]&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;TransformType(table.Columns[en.Key.ToString()].DataType,&nbsp;en.Value);<br></span><span style="color: rgb(0, 128, 128);">199</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">200</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table.Rows.Add(row);<br></span><span style="color: rgb(0, 128, 128);">201</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">202</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.OverwriteChanges;<br></span><span style="color: rgb(0, 128, 128);">203</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_owner.ConflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOptions.CompareAllValues)<br></span><span style="color: rgb(0, 128, 128);">204</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">205</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.CompareAllSearchableValues;<br></span><span style="color: rgb(0, 128, 128);">206</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">207</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">208</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;affectedRows&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Update(_owner.Criteria,&nbsp;table,&nbsp;conflictDetection);<br></span><span style="color: rgb(0, 128, 128);">209</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">210</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">211</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">212</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">213</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;ExecuteUpdate(IDictionary&nbsp;keys,&nbsp;IDictionary&nbsp;values,&nbsp;IDictionary&nbsp;oldValues)<br></span><span style="color: rgb(0, 128, 128);">214</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">215</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">216</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">217</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;table&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Select(criteria);<br></span><span style="color: rgb(0, 128, 128);">218</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">&nbsp;table.Rows.Count&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">219</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">No&nbsp;row&nbsp;is&nbsp;matching&nbsp;specified&nbsp;key&nbsp;values.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">220</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table.Rows.Count&nbsp;</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">221</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">More&nbsp;than&nbsp;one&nbsp;rows&nbsp;are&nbsp;matching&nbsp;specified&nbsp;key&nbsp;values,&nbsp;please&nbsp;check&nbsp;the&nbsp;key&nbsp;columns&nbsp;setting.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">222</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;row&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;table.Rows[</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">];<br></span><span style="color: rgb(0, 128, 128);">223</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.OverwriteChanges;<br></span><span style="color: rgb(0, 128, 128);">224</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_owner.ConflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOptions.CompareAllValues)<br></span><span style="color: rgb(0, 128, 128);">225</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">226</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DetectDataRowConflicts(oldValues,&nbsp;row);<br></span><span style="color: rgb(0, 128, 128);">227</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.CompareAllSearchableValues;<br></span><span style="color: rgb(0, 128, 128);">228</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">229</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">230</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;en&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;values.GetEnumerator();<br></span><span style="color: rgb(0, 128, 128);">231</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">&nbsp;(en.MoveNext())<br></span><span style="color: rgb(0, 128, 128);">232</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">233</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table.Columns.Contains(en.Key.ToString()))<br></span><span style="color: rgb(0, 128, 128);">234</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row[en.Key.ToString()]&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;TransformType(table.Columns[en.Key.ToString()].DataType,&nbsp;en.Value);<br></span><span style="color: rgb(0, 128, 128);">235</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">236</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">237</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;affectedRows&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Update(_owner.Criteria,&nbsp;table,&nbsp;conflictDetection);<br></span><span style="color: rgb(0, 128, 128);">238</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">239</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">240</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">241</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">242</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">&nbsp;ExecuteDelete(IDictionary&nbsp;keys,&nbsp;IDictionary&nbsp;oldValues)<br></span><span style="color: rgb(0, 128, 128);">243</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">244</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">245</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">246</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;table&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Select(criteria);<br></span><span style="color: rgb(0, 128, 128);">247</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);">&nbsp;table.Rows.Count&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">248</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">No&nbsp;row&nbsp;is&nbsp;matching&nbsp;specified&nbsp;key&nbsp;values.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">249</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(table.Rows.Count&nbsp;</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">250</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">throw</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">More&nbsp;than&nbsp;one&nbsp;rows&nbsp;are&nbsp;matching&nbsp;specified&nbsp;key&nbsp;values,&nbsp;please&nbsp;check&nbsp;the&nbsp;key&nbsp;columns&nbsp;setting.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">251</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">252</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;row&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;table.Rows[</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">];<br></span><span style="color: rgb(0, 128, 128);">253</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.OverwriteChanges;<br></span><span style="color: rgb(0, 128, 128);">254</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_owner.ConflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOptions.CompareAllValues)<br></span><span style="color: rgb(0, 128, 128);">255</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">256</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DetectDataRowConflicts(oldValues,&nbsp;row);<br></span><span style="color: rgb(0, 128, 128);">257</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conflictDetection&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;ConflictOption.CompareAllSearchableValues;<br></span><span style="color: rgb(0, 128, 128);">258</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">259</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">260</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;row.Delete();<br></span><span style="color: rgb(0, 128, 128);">261</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">262</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;affectedRows&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.Update(_owner.Criteria,&nbsp;table,&nbsp;conflictDetection);<br></span><span style="color: rgb(0, 128, 128);">263</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">264</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">265</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">266</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">override</span><span style="color: rgb(0, 0, 0);">&nbsp;IEnumerable&nbsp;ExecuteSelect(DataSourceSelectArguments&nbsp;arguments)<br></span><span style="color: rgb(0, 128, 128);">267</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">268</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">269</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">270</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(arguments&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);">&nbsp;arguments&nbsp;</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);">&nbsp;DataSourceSelectArguments.Empty)<br></span><span style="color: rgb(0, 128, 128);">271</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">272</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">adjust&nbsp;criteria&nbsp;according&nbsp;to&nbsp;arguments</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">273</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(arguments.RetrieveTotalRowCount)<br></span><span style="color: rgb(0, 128, 128);">274</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">275</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arguments.TotalRowCount&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;_owner._service.SelectCount(criteria);<br></span><span style="color: rgb(0, 128, 128);">276</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_owner.LastTotalCount&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;arguments.TotalRowCount;<br></span><span style="color: rgb(0, 128, 128);">277</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">278</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(arguments.MaximumRows&nbsp;</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">279</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;criteria.MaxResults(arguments.MaximumRows);<br></span><span style="color: rgb(0, 128, 128);">280</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(arguments.StartRowIndex&nbsp;</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">281</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;criteria.SkipResults(arguments.StartRowIndex);<br></span><span style="color: rgb(0, 128, 128);">282</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 255);">string</span><span style="color: rgb(0, 0, 0);">.IsNullOrEmpty(arguments.SortExpression))<br></span><span style="color: rgb(0, 128, 128);">283</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">284</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(_owner.AlwaysAppendDefaultSortBysWhenSorting)<br></span><span style="color: rgb(0, 128, 128);">285</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;InsertSortExpressinAtTopOfSortBys(arguments.SortExpression,&nbsp;criteria);<br></span><span style="color: rgb(0, 128, 128);">286</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">287</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">288</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;criteria._sortBys.Clear();<br></span><span style="color: rgb(0, 128, 128);">289</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AppendSortExpression(criteria,&nbsp;arguments.SortExpression);<br></span><span style="color: rgb(0, 128, 128);">290</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">291</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">292</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">293</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">294</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DataView(_owner._service.Select(criteria));<br></span><span style="color: rgb(0, 128, 128);">295</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">296</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">297</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">#endregion</span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">298</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div><br></blockquote> <h3>参考 </h3>(1) SOA Design Pattern Catalog: <a title="http://www.soapatterns.org/" href="http://www.soapatterns.org/">http://www.soapatterns.org/</a><br><br> <p><em>//我是结尾符，待续…</em></p><img src="http://www.cnblogs.com/teddyma/aggbug/1424710.html?type=1" width="1" height="1" alt=""/><p>评论: 3　<a href="http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item><item><title>Apply SOA Design Patterns with WCF (4) WCF Database Paging &amp; Sorting (数据库端分页和排序)</title><link>http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html</link><dc:creator>Teddy's Knowledge Base</dc:creator><author>Teddy's Knowledge Base</author><pubDate>Fri, 27 Mar 2009 16:24:00 GMT</pubDate><guid>http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html</guid><description><![CDATA[<p>阅读: 2116 评论: 14 作者: <a href="http://www.cnblogs.com/teddyma/" target="_blank">Teddy's Knowledge Base</a> 发表于 2009-03-28 00:24 <a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html" target="_blank">原文链接</a></p><p><strong>Original (原创) by Teddy’s Knowledge Base</strong></p> <h3>Content (目录)</h3> <p>(1) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/23/1419329.html">WCF Configuration Centralization (WCF配置集中管理)</a></font></p> <p>(2) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/25/1421892.html">WCF Automatic Deployment (WCF自动化部署) </a></font></p> <p>(3) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/26/1422776.html">WCF Automatic Service Locating (WCF自动化服务定位)</a></font></p> <p>(4) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html">WCF Database Paging &amp; Sorting (WCF数据库分页和排序)</a></font></p> <p>(5) <font color="#0000ff"><a href="http://www.cnblogs.com/teddyma/archive/2009/03/30/1424710.html">WCF Based ASP.NET DataSouce Control (基于WCF的数据源控件)</a></font></p> <p>(6) 1 + 2 + 3 + 4 + 5 = ?</p> <p><b><font color="#0000ff"><strong><a href="http://www.dotnetjunkies.com/WebLog/teddy/archive/2009/03/27/589297.aspx" target="_blank">English Version</a></strong></font></b><br></p> <h3>摘要</h3> <p>本文提供一种支持跨WCF通讯的数据库端分页和排序(以及更多超过你预期的功能)方案。</p> <h3>正文</h3> <h4>我们在重新发明轮子吗？</h4> <p>已经有很多数据库端分页和排序的实现方案了，从微软的LINQ to SQL和Entity Framework到无数的ORM框架和基于存储过程的分页和排序实现。</p> <p>但是，构架得很好的支持跨WCF通信的数据库端分页和排序方案还很少见到。大多数数据库端分页和排序方案要么依赖于不能被序列化的对象，要么暴露了太多SQL相关的信息给客户端，甚至可能允许客户程序直接构造SQL或伪SQL片段，这样就不能很好的避免SQL注入。</p> <p>所以，我们是在创新而不是重新造轮子。</p> <h4>我们的目标</h4> <p>下面是这个跨WCF通信的分页排序方案的功能列表：</p> <ul> <li>LINQ风格的强类型查询语言</li> <li> 支持分页和排序</li> <li>支持常用的数据库操作和方法</li> <li>避免SQL注入</li> <li>隐藏数据结构和SQL的细节</li> <li>查询对象能改能跨WCF通信</li> <li>多数据库查询语言扩展支持</li> <li>支持和第三方诗句访问组件和ORM类库的整合</li></ul> <h4>类图</h4> <p><a href="http://www.cnblogs.com/images/cnblogs_com/teddyma/WindowsLiveWriter/ApplySOADesignPatternswithWCF4WCFDatabas_6240/NIntegrate.Query_4.jpg"><img title="NIntegrate.Query" style="border: 0px none ; display: inline;" alt="NIntegrate.Query" src="http://www.cnblogs.com/images/cnblogs_com/teddyma/WindowsLiveWriter/ApplySOADesignPatternswithWCF4WCFDatabas_6240/NIntegrate.Query_thumb_1.jpg" border="0" width="553" height="433"></a> </p> <h4>各个类的职责</h4> <ul> <li>Criteria – 主要的携带关于一个查询的所有信息的类</li> <li>IExpression – 所有构成Criteria的元素的接口</li> <li>Expression类– 代表查询中不同类型的表达式</li> <li>Parameter Expression类 – 代表不同类型的参数，每个参数包装了一个原生类型的数据值</li> <li>IColumn – 所有Column表达式的接口</li> <li>Column类 – 代表查询中不同类型的Column</li> <li>Condition – 代表一个逻辑表达式，可以参与诸如And，Or，Not这样的逻辑操作</li></ul> <h4>表达式的操作和方法</h4> <ul> <li>常用的操作和方法应该定义为类的公共方法，并且，如果可能，为每个操作也定义相应的操作符重载</li> <li>对特定数据库的操作和方法应该要么定义在继承的子类中，要么定义为扩展方法</li></ul> <h4>查询示例代码</h4><blockquote><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">&nbsp;1</span>&nbsp;<span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;TestCriteria&nbsp;:&nbsp;Criteria<br></span><span style="color: rgb(0, 128, 128);">&nbsp;2</span>&nbsp;<span style="color: rgb(0, 0, 0);">{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;3</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;TestCriteria()<br></span><span style="color: rgb(0, 128, 128);">&nbsp;4</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;</span><span style="color: rgb(0, 0, 255);">base</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">TestTable</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,&nbsp;</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Test</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">&nbsp;5</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">&nbsp;6</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;}<br></span><span style="color: rgb(0, 128, 128);">&nbsp;7</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">&nbsp;8</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;BooleanColumn&nbsp;BooleanColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;BooleanColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">BooleanColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">&nbsp;9</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;ByteColumn&nbsp;ByteColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;ByteColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ByteColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">10</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;Int16Column&nbsp;Int16Column&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;Int16Column(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Int16Column</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">11</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;Int32Column&nbsp;Int32Column&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;Int32Column(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Int32Column</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">12</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;Int64Column&nbsp;Int64Column&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;Int64Column(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Int64Column</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">13</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;DateTimeColumn&nbsp;DateTimeColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DateTimeColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">DateTimeColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">14</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;StringColumn&nbsp;StringColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;StringColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">StringColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">15</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;GuidColumn&nbsp;GuidColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;GuidColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">GuidColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">16</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;DoubleColumn&nbsp;DoubleColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DoubleColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">DoubleColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">17</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;DecimalColumn&nbsp;DecimalColumn&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;DecimalColumn(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">DecimalColumn</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">18</span>&nbsp;<span style="color: rgb(0, 0, 0);">}<br></span><span style="color: rgb(0, 128, 128);">19</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">20</span>&nbsp;<span style="color: rgb(0, 0, 0);">var&nbsp;criteria&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);">&nbsp;TestCriteria();<br></span><span style="color: rgb(0, 128, 128);">21</span>&nbsp;<span style="color: rgb(0, 0, 0);">criteria.MaxResults(</span><span style="color: rgb(128, 0, 128);">10</span><span style="color: rgb(0, 0, 0);">).AddSortBy(criteria.Int32Column,&nbsp;</span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">).AddSortBy(criteria.StringColumn,&nbsp;</span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">22</span>&nbsp;<span style="color: rgb(0, 0, 0);">criteria.And(criteria.Int32Column&nbsp;</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">).Or(criteria.StringColumn.Like(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">test</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br></span><span style="color: rgb(0, 128, 128);">23</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">24</span>&nbsp;<span style="color: rgb(0, 0, 0);">criteria.AddResultColumn(DateTimeColumn).AddResultColumn((criteria.Int32Column&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">).As(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ID</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)).AddResultColumn(criteria.StringColumn.As(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Name</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br></span><span style="color: rgb(0, 128, 128);">25</span>&nbsp;<span style="color: rgb(0, 0, 0);">criteria.SkipResults(</span><span style="color: rgb(128, 0, 128);">10</span><span style="color: rgb(0, 0, 0);">);<br></span><span style="color: rgb(0, 128, 128);">26</span>&nbsp;<span style="color: rgb(0, 0, 0);">criteria.Distinct();<br></span><span style="color: rgb(0, 128, 128);">27</span>&nbsp;<span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">28</span>&nbsp;<span style="color: rgb(0, 0, 0);">var&nbsp;queryResult&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;aWcfService.Query(criteria);</span><br></div></blockquote><h4>如何使类能够作为WCF服务的参数被序列化</h4> <p>这些类的结构和上面的查询示例代码可能和大多数SQL风格的查询语言很相似，真正的实现难点其实在如何使他们能够作为WCF服务的参数被序列化。下面的要点能帮助实现这个目标：</p> <ul> <li>除了Criteria的所有的类应该要么定位为sealed类，要么只有internal的构造函数，这样就能确保在我们定义的程序集之外不会有子类</li> <li>所有的类应该标注为WCF的DataContract，所有的字段应该标注为DataMember</li> <li>所有的类都不应该包含不能被序列化的字段</li> <li>一个类的所有依赖类型都应该被加进这个类的定义的KnownType列表中，例如，因为Criteria类依赖于所有其他的表达式类型，所以，Criteria类的定义应该像下面这样：</li></ul> <blockquote><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);">&nbsp;1</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[DataContract]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;2</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(BooleanColumn))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;3</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(ByteColumn))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;4</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int16Column))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;5</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int32Column))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;6</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int64Column))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;7</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DateTimeColumn))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;8</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(StringColumn))]<br></span><span style="color: rgb(0, 128, 128);">&nbsp;9</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(GuidColumn))]<br></span><span style="color: rgb(0, 128, 128);">10</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DoubleColumn))]<br></span><span style="color: rgb(0, 128, 128);">11</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DecimalColumn))]<br></span><span style="color: rgb(0, 128, 128);">12</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Condition))]<br></span><span style="color: rgb(0, 128, 128);">13</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(NullExpression))]<br></span><span style="color: rgb(0, 128, 128);">14</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(BooleanExpression))]<br></span><span style="color: rgb(0, 128, 128);">15</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(ByteExpression))]<br></span><span style="color: rgb(0, 128, 128);">16</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int16Expression))]<br></span><span style="color: rgb(0, 128, 128);">17</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int32Expression))]<br></span><span style="color: rgb(0, 128, 128);">18</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int64Expression))]<br></span><span style="color: rgb(0, 128, 128);">19</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DateTimeExpression))]<br></span><span style="color: rgb(0, 128, 128);">20</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(StringExpression))]<br></span><span style="color: rgb(0, 128, 128);">21</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(GuidExpression))]<br></span><span style="color: rgb(0, 128, 128);">22</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DoubleExpression))]<br></span><span style="color: rgb(0, 128, 128);">23</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DecimalExpression))]<br></span><span style="color: rgb(0, 128, 128);">24</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(ExpressionCollection))]<br></span><span style="color: rgb(0, 128, 128);">25</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(BooleanParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">26</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(ByteParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">27</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int16ParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">28</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int32ParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">29</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(Int64ParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">30</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DateTimeParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">31</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(StringParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">32</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(GuidParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">33</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DoubleParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">34</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;[KnownType(</span><span style="color: rgb(0, 0, 255);">typeof</span><span style="color: rgb(0, 0, 0);">(DecimalParameterExpression))]<br></span><span style="color: rgb(0, 128, 128);">35</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);">&nbsp;Criteria<br></span><span style="color: rgb(0, 128, 128);">36</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;{<br></span><span style="color: rgb(0, 128, 128);">37</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">…</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">38</span>&nbsp;<span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">39</span>&nbsp;<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;}</span><br></div></blockquote> <h4>第三方数据访问和ORM类库整合</h4> <p>因为上面讨论的类都不是只能用于特定数据库访问组件的，所以，一个criteria可以被认为是一个查询的元数据，可以被翻译为任意一个实际的数据访问实现。例如，翻译成LINQ to SQL查询语言或者翻译成一个能直接执行的DbCommand。</p> <h4>基于Criteria的WCF服务的好处</h4> <ul> <li>支持复杂条件的查询</li> <li>更容易的支持分页和排序</li> <li>极大的减少数据库风格的查询类型的服务的数量</li></ul> <h3>提示</h3> <ul> <li>无论LINQ还是这种强类型的查询语言都有额外的运行时消耗，包括构造criteria和翻译成实际的数据访问语言的内存、CPU运行时间消耗。所以对高性能场景，存储过程还是应该是数据库查询类服务首选的实现方案。</li> <li>在实践中，对企业级应用来说，一般，除了专门用来实现并不容易实现的分页和排序功能，这种基于Criteria的WCF服务更多的还是用来实现原型程序和被用来在最终的应用中作为一个后备服务。我还是会定义包含清晰的业务含义名称的服务，如LoadByID()，GetAllXXX()，并且只要可能就用存储过程来实现。</li></ul> <h3>参考 <br></h3>(1) SOA Design Pattern Catalog: <a title="http://www.soapatterns.org/" href="http://www.soapatterns.org/">http://www.soapatterns.org/</a><br><br><br><p><em>//我是结尾符，待续…</em></p><img src="http://www.cnblogs.com/teddyma/aggbug/1423780.html?type=1" width="1" height="1" alt=""/><p>评论: 14　<a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html#pagedcomment" target="_blank">查看评论</a>　<a href="http://www.cnblogs.com/teddyma/archive/2009/03/28/1423780.html#commentform" target="_blank">发表评论</a></p><hr/><p>最新新闻：<br/>· <a href="http://news.cnblogs.com/n/56799/" target="_blank">百度第四季度净利润6270万美元 同比增48.2%</a><span style="color:gray">(2010-02-10 09:10)</span><br/>· <a href="http://news.cnblogs.com/n/56798/" target="_blank">现场直播：Google 社会化产品 Google Buzz 发布</a><span style="color:gray">(2010-02-10 09:01)</span><br/>· <a href="http://news.cnblogs.com/n/56797/" target="_blank">阿里巴巴3月推1688网络批发 胡戈韩寒出力宣传</a><span style="color:gray">(2010-02-10 08:48)</span><br/>· <a href="http://news.cnblogs.com/n/56796/" target="_blank">第一代互联网拓荒者再掀连环创业潮</a><span style="color:gray">(2010-02-10 08:47)</span><br/>· <a href="http://news.cnblogs.com/n/56795/" target="_blank">雅虎将永久性关闭科技站点Yahoo! Tech</a><span style="color:gray">(2010-02-10 08:45)</span><br/></p><p>编辑推荐：<a href="http://news.cnblogs.com/n/56782/" target="_blank">2010年2月编程语言排行榜</a><br/></p><p>网站导航：<a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/" target="_blank">个人主页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://home.cnblogs.com/group/" target="_blank">小组</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://kb.cnblogs.com" target="_blank">知识库</a></p>]]></description></item></channel></rss>