﻿<?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>博客园-Zongsoft Corporation</title><link>http://www.cnblogs.com/SW515/</link><description /><language>zh-cn</language><lastBuildDate>Sun, 05 Jul 2009 01:03:26 GMT</lastBuildDate><pubDate>Sun, 05 Jul 2009 01:03:26 GMT</pubDate><ttl>60</ttl><item><title>恢复Ico图标文件在资源管理器中的显示</title><link>http://www.cnblogs.com/SW515/archive/2007/08/24/868912.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Fri, 24 Aug 2007 13:58:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2007/08/24/868912.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/868912.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2007/08/24/868912.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/868912.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/868912.html</trackback:ping><description><![CDATA[<p>　　在安装了某些看图或者图片编辑软件后，可能会导致ico图标、cur/ani光标文件在资源管理器中显示的不再是其本身的图片内容，而是某个特定的图标，这对于直接查看图标文件很不方便，如果要恢复其默认的可见方式，可在命令窗口[ cmd ]中使用如下命令：</p>
<br />
<p style="font-size: 12pt; font-family: Courier New">assoc .ico=icofile<br />
assoc .cur=curfile<br />
assoc .ani=anifile<br />
</p>
<img src ="http://www.cnblogs.com/SW515/aggbug/868912.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47970/" target="_blank">19岁天才黑客发布首个iPhone 3GS破解软件</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>深入剖析 ASP.NET 1.x 中 Forms 身份验证(1)</title><link>http://www.cnblogs.com/SW515/archive/2006/10/25/539489.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Wed, 25 Oct 2006 06:03:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2006/10/25/539489.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/539489.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2006/10/25/539489.html#Feedback</comments><slash:comments>12</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/539489.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/539489.html</trackback:ping><description><![CDATA[<p style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; COLOR: maroon; FONT-FAMILY: 仿宋_gb2312">前言</p>
<p style="FONT-SIZE: 11pt; TEXT-INDENT: 2em">今年六月份做的一个视频讲座，只做了上半部分的理论和代码解析部分，本打算还有下半部分的范例演示的，但因为时间和惰性，一直拖到现在也没把下半部分都做完。<br>　　最近，因为刚好讲到ASP.NET 1.1中FormAuthentication部分的课程，有些内容在课堂上不宜深入讨论，所以，索性将这个只讲到一半的东西再拿出来发给学员。相信大家看了这上部分的视频演讲后，自己再动手完成代码应该不会有什么大问题了。因为 ASP.net 2.0中加入了新的有关身份验证和授权方面的元素，所以，这便成为我虎头蛇尾的最佳借口了罢。<br><br></p>
<p style="FONT-SIZE: 12pt; COLOR: navy; FONT-FAMILY: 楷体_gb2312" align=center>那么，下面就给出以前写好的申明和下载链接。</p>
<hr>
<br>
<center>
<h1 style="FONT-FAMILY: 黑体" align=center>深入剖析 ASP.NET 1.x 中 Forms 身份验证</h1>
<p style="FONT-WEIGHT: bold; FONT-SIZE: 14pt; COLOR: navy; FONT-FAMILY: 仿宋_gb2312" align=center>作者：钟峰<br>2006年6月6日&#183;深圳</p>
<div style="FONT-SIZE: 11pt; WIDTH: 70%; LINE-HEIGHT: 130%; LETTER-SPACING: 1px; TEXT-ALIGN: left">
<h2>前言</h2>
<p style="TEXT-INDENT: 2em">在 ASP.NET 中，加入了许多以前需要开发者自行实现的功能，其中包括 <font face="Courier New" color=navy><strong>IsPostBack</strong></font> 判断、窗体元素(控件)的状态保持(ViewState)、身份验证和Url授权等，但在实际开发中至今仍然有不少的 ASP.NET 开发者还在重新撰写自定义身份验证的代码，其或使用 <font face="Courier New" color=navy><strong>HttpCookie</strong></font> 或使用 <font face="Courier New" color=navy><strong>HttpSessionState</strong></font> 会话状态包等来维护登录用户的身份标识。 </p>
<p style="TEXT-INDENT: 2em">出现这种现象的根本原因，还是因为开发人员对 ASP.NET 提供的Forms身份验证机制搞不清楚，又或者是一知半解。如果，你对 ASP.NET 中的Forms身份验证还是云里雾里，又或者想弄清楚它为什么要被设计成这样，又或者想弄清楚与之相关的 .NET Framework 类的内部运作机理的话，那么，或许这个视频讲座有助于你解决这些疑惑。 </p>
<h2 style="MARGIN-TOP: 50px">内容</h2>
<p style="TEXT-INDENT: 2em">我将着重从这些方面讲解有关Forms身份验证和授权的问题： </p>
<ul>
    <li>基本概念：什么是验证和授权？在 ASP.NET 中关于验证和授权方面有哪些基本类和接口？
    <li>处理流程：身份验证的基本流程？在 ASP.NET 中Forms验证和Url授权是如何作用和交互？
    <li>代码剖析：反编译 ASP.NET 中相关的源码，看看它们的工作机理及处理细节？
    <li>代码演示：<u>基于自定义用户表的身份验证等其他功能的实现。</u>
    <li>口令加密：介绍如何使用 Salt 口令加密以提升口令被字典式攻击的难度？
    <li>基于角色：在 ASP.NET 中是如何处理基于角色的授权？以及如何扩展它？
    <li>其他技巧：
    <ol>
        <li>处理身份验证和授权的注意事项？
        <li>网络场中的身份验证 Cookie 的处理？ </li>
    </ol>
    </li>
</ul>
<h2 style="MARGIN-TOP: 50px">下载</h2>
<p style="TEXT-INDENT: 2em">你可以选择以下站点进行下载： </p>
<p style="FONT-SIZE: 9pt; TEXT-INDENT: 2em; FONT-FAMILY: Arial"><strong>站点一：</strong>
<ul style="MARGIN-TOP: 5px; FONT-SIZE: 9pt; FONT-FAMILY: Arial">
    <li>视频下载：
    <ol>
        <li><!--a href="http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Video-1.rar"-->http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Video-1.rar<!--/a--><font color=maroon><em>(23MB)</em></font>
        <li><!--a href="http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Video-2.rar"-->http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Video-2.rar<!--/a--> </li>
    </ol>
    <li>代码文档：<!--a href="http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Other.rar"-->http://www.zongsoft.com/Tech/WebCasts/FormsAuthentication-Other.rar<!--/a--> </li>
</ul>
<p>&nbsp;</p>
<p style="FONT-SIZE: 9pt; TEXT-INDENT: 2em; FONT-FAMILY: Arial"><strong>站点二：</strong>
<ul style="MARGIN-TOP: 5px; FONT-SIZE: 9pt; FONT-FAMILY: Arial">
    <li>视频下载：
    <ol>
        <li><a href="http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Video-1.rar">http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Video-1.rar</a><font color=maroon><em>(23MB)</em></font>
        <li><!--a href="http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Video-2.rar"-->http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Video-2.rar<!--/a--> </li>
    </ol>
    <li>代码文档：<!--a href="http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Other.rar"-->http://www.totogogo.com/Zongsoft/Tech/WebCasts/FormsAuthentication-Other.rar<!--/a--> </li>
</ul>
<p>&nbsp;</p>
<h2 style="MARGIN-TOP: 50px">版权声明</h2>
<p style="COLOR: maroon; TEXT-INDENT: 2em">严禁修改视频内容，严禁修改演示文档和代码。如果要转载本讲座中的视频或文档和代码，请保留其完整的原始信息，不得篡改，不得分解后进行局部转载、发布。<br>　　本讲座中的所有信息和资源（包括视频和文档、代码等）在未经本人同意和授权，不得应用于任何商业场合，违者追求其法律责任。 </p>
<p>如您要转载我的文章或视频等信息时，请遵守以下事项：<br>1、请完整的转载整篇文章，不要转载或摘录其部分内容。<br>2、请在转载标题中标注&#8220;转载&#8221;二字，并于文本内的显著位置注明转载来源。 </p>
<a name=#Author></a>
<div style="BORDER-RIGHT: black 1px dotted; PADDING-RIGHT: 6px; BORDER-TOP: black 1px dotted; MARGIN-TOP: 40px; PADDING-LEFT: 6px; FONT-SIZE: 10pt; PADDING-BOTTOM: 6px; BORDER-LEFT: black 1px dotted; COLOR: navy; TEXT-INDENT: 2em; PADDING-TOP: 6px; BORDER-BOTTOM: black 1px dotted; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #f0f0f0">
<p style="MARGIN: 3px; TEXT-INDENT: 2em">作者：<strong>钟峰(Popeye Zhong)</strong>目前是 <a href="http://www.sz-accp.net/" target=_blank>北大青鸟（深圳中青）授权培训中心</a> 二学年的讲师，负责讲授 .NET(WinForms, ASP.NET) 以及 SQL Server 课程。<br></p>
<p style="MARGIN: 3px; TEXT-INDENT: 2em">曾经使用 C 语言做过图形程序设计，在相当长的一段时期内从事 COM/COM+ 组件的开发和设计工作，并且短暂的做过 Lotus/Notes 和 Dialogic 语音卡程序的开发，从2003年初开始进入.NET这个充满趣味和挑战的开发平台。感兴趣的除了企业应用架构设计、组件开发、安全、图像处理外还对汽车和枪械模型有浓厚的兴趣。如果希望与他联系，可访问 <a href="http://sw515.cnblogs.com/" target=SW515.cnblogs.com>http://SW515.cnblogs.com</a> 或者发送电子邮件到：<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#119;&#53;&#49;&#53;&#64;&#50;&#49;&#99;&#110;&#46;&#99;&#111;&#109;">SW515@21cn.com</a>。 </p>
</div>
</div>
</center>
<img src ="http://www.cnblogs.com/SW515/aggbug/539489.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47969/" target="_blank">新浪邮箱大本营粉墨登场！Sina.cn开放注册</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>北大青鸟（深圳中青）培训中心招聘： .NET 讲师</title><link>http://www.cnblogs.com/SW515/archive/2006/10/20/534922.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Fri, 20 Oct 2006 09:02:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2006/10/20/534922.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/534922.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2006/10/20/534922.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/534922.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/534922.html</trackback:ping><description><![CDATA[<h2 style="COLOR: red; FONT-FAMILY: 黑体" align=center>招聘.NET讲师</h2>
<p><span style="COLOR: #000080"><strong>人数：</strong></span>1 ~ 2人</p>
<p><font color=#000080><strong>工作地点：</strong></font>深圳市南山区(学府路)</p>
<p><font color=#000080><strong>工作性质：</strong></font>全职</p>
<br>
<p><span style="COLOR: #000080"><strong>要求：</strong></span></p>
<ol>
    <li>一年以上.NET企业软件开发经验
    <li>熟悉面向对象的设计方法和编程技术
    <li>熟悉.NET基础开发技术
    <ul>
        <li>C# 和.NET 基础结构<em style="COLOR: #800000">（Xml配置、Boxing/Unboxing、异常处理机制、多线程开发、序列化机制、AppDomain、垃圾回收机制等）</em>
        <li>ADO.NET
        <li>WinForms
        <li>ASP.NET </li>
    </ul>
    <li>熟悉T-SQL或P/L-SQL等任一种数据库脚本语言开发 </li>
</ol>
<hr SIZE=1>
<p style="MARGIN-TOP: 50px; FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 仿宋_gb2312">有意者请发邮件到：<font color=blue>Zongsoft#gmail.com</font><em>（将#换成@）</em></p>
<p style="MARGIN-TOP: 30px; FONT-WEIGHT: bold; FONT-SIZE: 14pt; COLOR: maroon; FONT-FAMILY: 楷体_gb2312">我们提供宽松的工作环境、优厚的薪酬福利机制。<br>更多详细情况请浏览我们的网站：<a style="FONT-FAMILY: Arial" href="http://www.sz-accp.net/" target=_blank>http://www.sz-accp.net</a></p>
<img src ="http://www.cnblogs.com/SW515/aggbug/534922.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47968/" target="_blank">IE市场份额首次跌破60%</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>.NET 2.0 中的自定义配置处理</title><link>http://www.cnblogs.com/SW515/archive/2006/08/21/482411.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Mon, 21 Aug 2006 07:16:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2006/08/21/482411.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/482411.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2006/08/21/482411.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/482411.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/482411.html</trackback:ping><description><![CDATA[<style>
<!--
h3{margin-top:3em}
p{text-indent:2em; margin-top:10px; margin-bottom:0px}
ol,ul{margin-top:5px; margin-bottom:5px}
a{text-decoration:none}
a:hover{text-decoration:underline}
.code{text-indent:0; font-family:Courier New; font-size:9pt; letter-spacing:0}
.codeArea{text-indent:0; font-family:Courier New; font-size:9pt; letter-spacing:0; border:1 solid gray; padding:6px}
-->
</style>
</head>
<body>
<div style="font-family:宋体; font-size:9pt; color:#333333; letter-spacing:2; line-height:1.5">
<h2 style="font-family:仿宋_gb2312; font-variant:small-caps; margin-bottom:0">.NET 2.0 中的自定义配置处理</h2>
<h3 style="font-family:仿宋_gb2312; margin-top:0">——编程模型</h3>
<p style="text-indent:0">发布日期：2006-8-21 &#167; 更新日期：2006-8-21</p>
<span><a target="_blank" href="http://sw515.cnblogs.com">钟峰</a><font face="Arial">(Popeye Zhong)</font><br/>
<a href="_blank" href="http://www.Zongsoft.com">中汉软件有限公司</a><font face="Arial">(Zongsoft Corporation)</font></span>
<p style="text-align:center; font-size:30pt; font-weight:bolder; letter-spacing:0">...</p>
<h3>目录</h3>
<ol>
      <li><a href="#Foreword">引言</a></li>
      <li><a href="#Summarize">概述</a></li>
      <li><a href="#Declaration">配置声明</a></li>
      <li><a href="#NodeEntity">节点映射</a></li>
      <li><a href="#NodeCollection">节点集合</a></li>
      <li><a href="#Conclusion">总结</a></li>
      <li><a href="#Download">下载</a></li>
      <li><a href="#Resources">其他资源</a></li>
</ol>
<h3><a name="Foreword">引言</a></h3>
<p>现代软件开发中，各种技术、技巧越来越依赖配置，譬如客户端对用户体验的个性化设置、系统的各种运行时参数设置、可插拔的插件机制、基于配置的IoC架构模式等。配置方式也从最初的二进制存储格式逐步过度到INI文本格式直至今时所广泛使用的Xml格式。使用Xml格式进行配置，大大提高了对设置数据的表现能力，但是在 .NET 1.x 中对Xml配置的操控还有诸多不便，尤其是对Xml配置的存储同步机制很不完善，而从 .NET 2.0 开始，框架提供了更丰富和易于操控使用的机制。</p>
<p>.NET 中的配置文件(Xml)必须以&#8220;&lt;configuration&gt;&#8221;为根节点，配置文件分为两大部分：<b>配置声明区</b>和<b>数据设置区</b>。</p>
<ul>
      <li>配置声明区：位于&lt;configuration&gt;&lt;configSections&gt;内，通过&lt;section&gt;节点进行声明定义。</li>
      <li>数据设置区：位于&lt;configuration&gt;根节点内除&lt;configSections&gt;以外的任意节点。</li>
</ul>
<p>数据设置区可以是用户定义的任意结构层次，但是其&#8220;根节点&#8221;必须预先在设置声明区定义，运行时会进行有效性检测，一旦发现没有声明的配置节点则会产生一个运行时配置异常。</p>
<span style="font-weight:bold; color:navy; margin-top:10px; display:block">范例配置文件</span>
<div class="codeArea">
<?xml version="1.0"?>
<font color="navy">&lt;configuration&gt;</font><br/>
&nbsp;&nbsp;<font color="navy">&lt;configSections&gt;</font><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;section</font> name="dataSystems" type="SWSystem.Data.Configuration.DataSystemsSection, SWSystem.Data" /&gt;<br/>
&nbsp;&nbsp;<font color="navy">&lt;/configSections&gt;</font><br/><br/>
&nbsp;&nbsp;<font color="navy">&lt;dataSystems&gt;</font><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;dataSystem</font> name="iMRP" currentProvider="SQLProvider"&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;dataProvider</font> name="MSSqlProvider" type="SWSystem.Data.Providers.SQLDataProvider" dataFile="D:\Zongsoft\Develop 2005\SWSystem.Data\Services\SWDataEngine.xml" connectionString="UID=sa;PWD=;Initial Catalog=iMRP;Data Source=127.0.0.1" /&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;dataProvider</font> name="PostgreSqlProvider" type="SWSystem.Data.Providers.PostgreDataProvider" dataFile="D:\Zongsoft\Develop 2005\SWSystem.Data\Services\SWDataEngine.xml" connectionString="Server=127.0.0.1;Port=5432;User Id=postgres;Password=postgres;Database=iMRP;Encoding=UNICODE;" /&gt;<br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;dataModules&gt;</font><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;add</font> name="StockModule" type="Zongsoft.Applications.iMRP.Business.StockModule, Zongsoft.Applications.iMRP.Business" /&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;/dataModules&gt;</font><br/>
&nbsp;&nbsp;&nbsp;&nbsp;<font color="navy">&lt;/dataSystem&gt;</font><br/>
&nbsp;&nbsp;<font color="navy">&lt;/dataSystems&gt;</font><br/>
<font color="navy">&lt;/configuration&gt;</font>
</div>
<h3><a name="Summarize">概述</a></h3>
<p style="text-indent:2em">在.NET 2.0中实现自定义配置，可以使用编程或声明性（属性化）代码编写模型创建自定义配置节。</p>
<ul style="margin-top:5px">
      <li>编程模型。此模型要求为每个节属性 (Attribute) 创建一个用于获取和/或设置其值的属性 (Property)，并将其添加到基础 ConfigurationElement 基类的内部属性 (Property) 包中。</li>
      <li>声明模型。这种比较简单的模型也称为属性 (Attribute) 化模型，允许您通过使用属性 (Property) 来定义节属性 (Attribute)，并使用属性 (Attribute) 对其进行修饰。</li>
</ul>
<p style="text-indent:2em; margin:20px; padding:6px; border:1 solid gray; background-color:#FFFFE0">配置文件中的元素称为 <font color="navy"><b>基本XML元素</b></font> 或 <font color="navy"><b>节</b></font>。基本元素只是具有相关属性（如果有）的简单 XML 标记。节最简单的形式与基本元素一致。而复杂的节可以包括一个或多个基本元素、元素的集合以及其他节。</p>
<p>ConfigurationProperty 类表示配置节点中的特性(Attribute)或它的子元素，我们要做的就是通过 ConfigurationProperty 类将配置实体类中的属性(Property)映射到对应的节点特性(Attribute)。</p>
<h3><a name="Declaration">配置声明</a></h3>
<p>要在配置文件中使用自定义的配置数据，必须在声明区通过&lt;section&gt;节点对自定义配置节处理程序进行声明，该节点有两个必需属性：name 和 type。</p>
<ul>
      <li>name 属性：指定与 type 属性中指定的配置节处理程序关联的配置节或元素的名称。这是该元素在配置文件的设置区中使用的名称。</li>
      <li>
            type 属性：指定用来处理 name 属性所指定的设置节的处理程序。使用如下格式：<br/>
            type="ConfigurationSectionHandlerClass, AssemblyFileName, Version, Culture, PublicKeyToken"<br/>
            如果对处理程序的版本没要求，或者其为无区域和强签名的程序集，则可以省略后面的三项，否则必须严格匹配版本。<b>注意：</b>程序集文件名不要带其扩展文件名<i>（通常为.dll）</i>。
      </li>
</ul>
<p>范例配置文件中的配置声明定义如：
<font color="navy">&lt;section</font> name="dataSystems" type="SWSystem.Data.Configuration.DataSystemsSection, SWSystem.Data" /&gt; 则表示数据设置区中的&lt;dataSystems&gt;节点由 <font face="Courier New" color="navy">SWSystem.Data.Configuration.DataSystemsSection</font> 类进行处理，并且该类位于 SWSystem.Data 程序集中。
</p>
<p>在 .NET 1.x 中要实现自定义的配置处理程序类，其必须实现 <font face="Courier New" color="navy">IConfigurationSectionHandler</font> 接口，现在 .NET 2.0 中只需要将你的处理程序类继承自 <font face="Courier New" color="navy">ConfigurationSection</font> 类即可。其处理步骤大致如下：</p>
<ol>
      <li>首先定义并创建一个 <span class="code">ConfigurationPropertyCollection</span> 类的实例，用以保存配置节点的特性(Attribute)以及它的所有子元素映射，当然你也可以使用 <span class="code">ConfigurationElement</span> 基类中的 <span class="code">Properties</span> 属性。</li>
      <li>然后创建 <span class="code">ConfigurationProperty</span> 类以映射到对应的节点特性(Attribute)或子元素。</li>
      <li>在类型构造函数或实例构造函数中，将创建的 <span class="code">ConfigurationProperty</span> 类实例加入到已创建好的 <span class="code">ConfigurationPropertyCollection</span> 集合中。</li>
</ol>
<p>最终，我们的范例配置处理程序类看起来可能是这样<i>（如果你使用声明模式则代码看起来没有这么麻烦，这些配置属性类将由框架运行时帮你反射生成，正因为如此，所以它的运行时效率要差些。）</i>：</p>
<p class="codeArea">
public class DataSystemsSection : ConfigurationSection<br>
{<br>
&nbsp;&nbsp;private static readonly ConfigurationProperty _dataSystems = new ConfigurationProperty(null, typeof(DataSystemElementCollection), null, ConfigurationPropertyOptions.IsDefaultCollection);<br/>
&nbsp;&nbsp;private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();<br/><br/>
&nbsp;&nbsp;static DataSystemsSection()<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_properties.Add(_dataSystems);<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public DataSystemElementCollection DataSystems<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (DataSystemElementCollection)base[_dataSystems];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;protected override ConfigurationPropertyCollection Properties<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return _properties;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/>
}
</p>
<h3><a name="NodeEntity">节点映射/配置实体</a></h3>
<p>为所有的配置节点创建对应的配置实体类，该类中的属性(Property)对应节点中的特性(Attribute)和子元素(集合)。其编写步骤和开发方式与处理程序类似，只是这时我们的基类变成了 <span class="code">ConfigurationElement</span>。</p>
<p class="codeArea">
public class DataSystemElement : ConfigurationElement<br/>
{<br/>
&nbsp;&nbsp;private static readonly ConfigurationProperty _name = new ConfigurationProperty("name", typeof(string), null, null, new StringValidator(1), ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);<br/>
&nbsp;&nbsp;private static readonly ConfigurationProperty _currentProvider = new ConfigurationProperty("currentProvider", typeof(string), string.Empty, ConfigurationPropertyOptions.IsRequired);<br/>
&nbsp;&nbsp;private static readonly ConfigurationProperty _dataModules = new ConfigurationProperty("dataModules", typeof(DataModuleElementCollection), null, ConfigurationPropertyOptions.None);<br/>
&nbsp;&nbsp;private static readonly ConfigurationProperty _dataProviders = new ConfigurationProperty(null, typeof(DataProviderElementCollection), null, ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsDefaultCollection);<br/><br/>
&nbsp;&nbsp;private static ConfigurationPropertyCollection      _properties = new ConfigurationPropertyCollection();<br/><br/>
&nbsp;&nbsp;#region 类型构造函数<br/>
&nbsp;&nbsp;static DataSystemElement()<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_properties.Add(_name);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_properties.Add(_currentProvider);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_properties.Add(_dataProviders);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;_properties.Add(_dataModules);<br/>
&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;#endregion<br/><br/>
&nbsp;&nbsp;#region 构造函数<br/>
&nbsp;&nbsp;public DataSystemElement()<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public DataSystemElement(string name)<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;this.Name = name;<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public DataSystemElement(string name, string currentProvider)<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;this.Name = name;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;this.CurrentProviderName = currentProvider;<br/>
&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;#endregion<br/><br/>
&nbsp;&nbsp;#region 公共属性<br/>
&nbsp;&nbsp;public string Name<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (string)base[_name];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;set<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;base[_name] = value;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public String CurrentProviderName<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (string)this[_currentProvider];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;set<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this[_currentProvider] = value;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public DataModuleElementCollection DataModules<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (DataModuleElementCollection)base[_dataModules];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/><br/>
&nbsp;&nbsp;public DataProviderElementCollection DataProviders<br/>
&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (DataProviderElementCollection)base[_dataProviders];<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;#endregion<br/>
}
</p>
<p>需要注意的是，&lt;dataProvider&gt; 和 &lt;dataModules&gt; 子元素处理方式的差异。</p>
<ul>
      <li>&lt;dataModules&gt; 是个嵌套的集合节点，它下面有标准的 &lt;add&gt;, &lt;remove&gt;, &lt;clear&gt; 子元素，且 &lt;dataModules&gt; 元素不能在同一个 &lt;dataSystem&gt; 节点下出现多次。</li>
      <li>&lt;dataProvider&gt; 是 &lt;dataSystem&gt; 节点下的直接子节点集合，&lt;dataProvider&gt; 是可以在同一个父节点下出现多次的集合项节点，故需要对其映射的 <span class="code">ConfigurationProperty</span> 类构造函数中的 <span class="code">options</span> 参数包含 <span class="code">ConfigurationPropertyOptions.IsDefaultCollection</span> 枚举项（它指示.NET框架构造一个嵌套节），另外，不能指定它对应的配置节点的名字，即必须保持构造函数中 <span class="code">name</span> 参数的值为空引用<i>(<font color="maroon">[C#]</font><font color="blue">null</font>/<font color="maroon">[VB.net]</font><font color="blue">Nothing</font>)</i>或空字符串<i>(String.Empty/"")</i>。</li>
</ul>
<h3><a name="NodeCollection">节点集合</a></h3>
<p>创建派生自 <span class="code">ConfigurationElementCollection</span> 的类，在派生类中必须重写(override)的抽象方法：</p>
<ul>
      <li><span class="code"><font color="blue">protected abstract</font> <font color="#008080">ConfigurationElement</font> CreateNewElement()</span></li>
      <ul>
            <li>在从配置文件加载集合时，会调用该方法以创建各个元素。重写该方法以创建特定类型的自定义 <span class="code">ConfigurationElement</span> 对象。</li>
      </ul>
      <li><span class="code"><font color="blue">protected abstract object</font> GetElementKey(<font color="#008080">ConfigurationElement</font> element)</span></li>
      <ul>
            <li>在派生类中重写时获取指定配置元素的键值。</li>
      </ul>
</ul>
<p style="margin-bottom:0">对于非默认的节点集合类，还必须重写 <span class="code">CollectionType</span> 和 <span class="code">ElementName</span> 只读属性的<b>getter</b>，其代码可能如下：</p>
<p class="codeArea">
protected override string ElementName<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "dataProvider"; <font color="green">//"dataProvider" replace with your elementName in collection.</font><br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}<br/><br/>
public override ConfigurationElementCollectionType CollectionType<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ConfigurationElementCollectionType.BasicMap;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
</p>
<p>可以重写 <span class="code">ThrowOnDuplicate</span> 只读属性的getter，以指示当向 <span class="code">ConfigurationElementCollection</span> 添加重复的 <span class="code">ConfigurationElement</span> 是否会导致引发异常。默认情况，只有当该元素的 <span class="code">CollectionType</span> 值为 <span class="code">AddRemoveClearMap</span> 或 <span class="code">AddRemoveClearMapAlternate</span> 时才会引发异常，如果希望非默认节点集合不接受重复项(通常如此)，那么就必须重写该属性的getter，始终返回真(<font color="blue">true</font>)。</p>
<p>请注意，键和值都相同的元素不会被视为重复元素，而是接受此类元素且不出现提示，只有键相同而值不同的元素才被视为是重复元素。原因是这些元素不会进行竞争。但是，无法添加键相同而值不同的元素，因为无法从逻辑上确定哪个竞争值有效。</p>
<p style="font-weight:bold">索引器的设计模式</p>
<p>通常需要定义索引器的两个重载(overloads)，一个接受整型数下标的可读写的索引器；一个是接受字符串键值的只读索引器。</p>
<p class="codeArea">
public DataProviderElement this[int index]<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (DataProviderElement)BaseGet(index);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
&nbsp;&nbsp;&nbsp;&nbsp;set<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(BaseGet(index) != null)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BaseRemoveAt(index);<br/><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BaseAdd(index, value);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}<br/><br/>
public new DataProviderElement this[string name]<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;get<br/>
&nbsp;&nbsp;&nbsp;&nbsp;{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (DataProviderElement)BaseGet(name);<br/>
&nbsp;&nbsp;&nbsp;&nbsp;}<br/>
}
<p>
<p style="font-weight:bold">其他事项</p>
<p>通常还需要公开一些对集合操作的方法，大致如下：</p>
<p class="codeArea">
public int IndexOf(DataProviderElement value)<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;return BaseIndexOf(value);<br/>
}<br/><br/>
public void Add(DataProviderElement value)<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;BaseAdd(value);<br/>
}<br/><br/>
public void Remove(DataProviderElement value)<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;if(BaseIndexOf(value) >= 0)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BaseRemove(value.Name);<br/>
}<br/><br/>
public void Remove(string name)<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;BaseRemove(name);<br/>
}<br/><br/>
public void RemoveAt(int index)<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;BaseRemoveAt(index);<br/>
}<br/><br/>
public void Clear()<br/>
{<br/>
&nbsp;&nbsp;&nbsp;&nbsp;BaseClear();<br/>
}
</p>
<h3><a name="Conclusion">总结</a></h3>
<p>这只是我想要撰写的有关 .NET 2.0 中的基础技术篇文章中的第一篇。在这篇文章中，我介绍了有关配置方面的一些基本概念，并阐述了在 .NET 2.0 中如何定制你自己的配置处理程序，以及这过程中需要注意的一些细节问题。您已经看到，通过对 .NET 2.0 中提供的基础架构的扩展，我们可以很容易完成特性化的配置定制。</p>
<h3><a name="Download">下载</a></h3>
<p>您可以从以下网址之一选择下载本文附带的源码：</p>
<ol>
      <li>中汉软件：<a href="http://www.zongsoft.com/Tech/Documents/TD20060821-src.zip">http://www.Zongsoft.com/Tech/Documents/TD20060821-src.zip</a></li>
      <li>车来车网：<a href="http://www.totogogo.com/Zongsoft/Tech/Documents/TD20060821-src.zip">http://www.totogogo.com/Zongsoft/Tech/Documents/TD20060821-src.zip</a></li>
</ol>
<h3><a name="Resources">其他资源</a></h3>
<p>可能某些转载的格式不利于阅读，那么请从以下的原版位置之一查看本文：</p>
<ol>
      <li>中汉软件：<a href="http://www.zongsoft.com/Tech/Documents/TD20060821.htm">http://www.Zongsoft.com/Tech/Documents/TD20060821.htm</a></li>
      <li>车来车网：<a href="http://www.totogogo.com/Zongsoft/Tech/Documents/TD20060821.htm">http://www.totogogo.com/Zongsoft/Tech/Documents/TD20060821.htm</a></li>
</ol>
<p style="margin:30px 20px 20px 20px; border:1 dotted gray; padding:10px; background-color:#FFFFE0">作者：钟峰(Popeye Zhong)目前是 北大青鸟（深圳中青）培训中心 的讲师，负责讲授.NET和SQL数据库开发课程。他曾经使用 C 语言做过图形程序设计，在相当长的一段时期内从事 COM/COM+ 组件的开发和设计工作，并且短暂的做过 Lotus/Notes 和 Dialogic 语音卡程序的开发，从2003年初开始使用.NET这个充满趣味和挑战的开发平台。感兴趣的除了企业应用架构设计、组件开发、安全、图像处理外还对汽车和枪械模型有浓厚的兴趣。如果希望与他联系，可访问 <a href="http://sw515.cnblogs.com">http://sw515.cnblogs.com</a> 或者Email SW515#21cn.com 。 </p>
</div><img src ="http://www.cnblogs.com/SW515/aggbug/482411.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47965/" target="_blank">Google App Engine宕机6小时——云的安全在哪里？</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>一个三层架构的WinForms程序的完整范例(.NET 1.1/Northwind)</title><link>http://www.cnblogs.com/SW515/archive/2006/08/07/469924.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Mon, 07 Aug 2006 06:54:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2006/08/07/469924.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/469924.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2006/08/07/469924.html#Feedback</comments><slash:comments>46</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/469924.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/469924.html</trackback:ping><description><![CDATA[<div style="FONT-SIZE: 9pt; WIDTH: 95%; LINE-HEIGHT: 1.5; FONT-FAMILY: 宋体; LETTER-SPACING: 2px; POSITION: relative; TEXT-ALIGN: left" align=center>
<p style="TEXT-INDENT: 2em"></p>
<table id=Zongsoft.Samples.Northwind style="BORDER-RIGHT: #e6e6e6 1px dotted; BORDER-TOP: #e6e6e6 1px dotted; FONT-SIZE: 9pt; BORDER-LEFT: #e6e6e6 1px dotted; COLOR: #333333; LINE-HEIGHT: 1.5; BORDER-BOTTOM: #e6e6e6 1px dotted; LETTER-SPACING: 2px; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=2 width="100%">
    <tbody>
        <tr bgColor=#f6f6f6 height=24>
            <td style="PADDING-LEFT: 8px; FONT-WEIGHT: bold; COLOR: navy; FONT-VARIANT: small-caps" vAlign=center noWrap width="60%"><img height=14 src="http://www.totogogo.com/Zongsoft/Images/Sign.gif" width=12> <font face=Arial>Northwind</font> 商业管理程序 </td>
            <td noWrap align=middle width="20%"></td>
            <td noWrap align=middle width=100><img height=12 src="http://www.totogogo.com/Zongsoft/Images/star.gif" width=13><img height=12 src="http://www.totogogo.com/Zongsoft/Images/star.gif" width=13><img height=12 src="http://www.totogogo.com/Zongsoft/Images/star.gif" width=13><img height=12 src="http://www.totogogo.com/Zongsoft/Images/star.gif" width=13><img height=12 src="http://www.totogogo.com/Zongsoft/Images/star.gif" width=13> </td>
            <td style="DISPLAY: none" noWrap align=middle width=60></td>
        </tr>
        <tr vAlign=top bgColor=#ffffff height=45>
            <td style="PADDING-RIGHT: 5px; BORDER-TOP: #e6e6e6 1px dotted; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; TEXT-INDENT: 2em; PADDING-TOP: 5px" colSpan=4>
            <p style="MARGIN-TOP: 4px; MARGIN-BOTTOM: 3px">该范例程序使用三(多)层架构，客户端采用 .NET WinForms 技术，通过 Web Services 进行 Internet/Intranet 分布式的部署和应用。 </p>
            <p style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; MARGIN: 0px; COLOR: navy">技术要点：</p>
            <ul style="MARGIN-TOP: 8px">
                <li>数据层
                <ul>
                    <li>存储过程的编写
                    <li>ADO.NET 中各种类的处理 </li>
                </ul>
                <li>中间层/传输层(Web Services)
                <ul>
                    <li>自定义身份验证 SoapHeader
                    <li>SoapExcetion 中的内部异常传递
                    <li>增强型的口令散列加密<span style="COLOR: #808080; FONT-STYLE: italic">(Salted)</span> </li>
                </ul>
                <li>客户端(.NET WinForms)
                <ul>
                    <li>DataGrid 的绑定
                    <li>单值<span style="COLOR: gray; FONT-STYLE: italic">(TextBox)</span>、列表型<span style="COLOR: gray; FONT-STYLE: italic">(ComboBox)</span>的绑定
                    <li>自定义绑定解析和格式化
                    <li>单表与主从表结构的绑定
                    <li>统一的未处理异常的显示
                    <li>登录与注销的处理技巧
                    <li>单窗口实例的处理技巧 </li>
                </ul>
                <li>其他技术/技巧应用
                <ul>
                    <li>身份验证的处理与通知
                    <li>常见模式的应用
                    <li>接口的应用技巧
                    <li>命名空间与程序集的设计与规划 </li>
                </ul>
                </li>
            </ul>
            <p style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; MARGIN: 0px; COLOR: navy">下载地址：</p>
            <ol style="MARGIN-TOP: 8px">
                <li style="WORD-WRAP: break-word">中汉软件：<a style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LETTER-SPACING: 1px" href="http://www.zongsoft.com/Tech/Samples/Zongsoft.Samples.Northwind.zip">Zongsoft.Samples.Northwind.zip</a>
                <li>车来车网：<a style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LETTER-SPACING: 1px" href="http://www.totogogo.com/Zongsoft/Tech/Samples/Zongsoft.Samples.Northwind.zip">Zongsoft.Samples.Northwind.zip</a> </li>
            </ol>
            <p style="FONT-WEIGHT: bold; FONT-SIZE: 11pt; MARGIN: 0px; COLOR: navy">引用资源：</p>
            <p style="MARGIN-TOP: 8px; MARGIN-BOTTOM: 0px">该程序需要使用 <font face="Courier New" color=blue>Zongsoft.Samples.*</font> 命名空间下的相关类库，请从以下站点选择下载所必需的公共类库。</p>
            <ol style="MARGIN-TOP: 8px">
                <li style="WORD-WRAP: break-word">中汉软件：<a style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LETTER-SPACING: 1px" href="http://www.zongsoft.com/Tech/Samples/Zongsoft.Samples.zip">Zongsoft.Samples.zip</a>
                <li>车来车网：<a style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; FONT-FAMILY: Arial; LETTER-SPACING: 1px" href="http://www.totogogo.com/Zongsoft/Tech/Samples/Zongsoft.Samples.zip">Zongsoft.Samples.zip</a> </li>
            </ol>
            </td>
        </tr>
        <tr bgColor=#eeeeee height=1>
            <td style="MARGIN-TOP: 0px; PADDING-TOP: 0px; HEIGHT: 1px" colSpan=4></td>
        </tr>
        <tr bgColor=#f6f6f6 height=24>
            <td style="PADDING-RIGHT: 2em; PADDING-LEFT: 2em; WIDTH: 100%; LETTER-SPACING: 1px; TEXT-ALIGN: center" colSpan=4><span style="COLOR: maroon">授权协议：</span>共享&nbsp; <span style="COLOR: maroon">开发平台：</span>.NET 1.1(C#/WinForm)&nbsp; <span style="COLOR: maroon">数据库：</span>SQLServer </td>
        </tr>
    </tbody>
</table>
</div>

<p style="margin-top:25px;FONT-WEIGHT: bold; FONT-SIZE: 14pt; COLOR: maroon; FONT-FAMILY: 仿宋_gb2312" align=center>该文章以及所有范例代码均为<a href="mailto:sw515@21cn.com">本人(Popeye Zhong)</a>原创。 </p><img src ="http://www.cnblogs.com/SW515/aggbug/469924.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47961/" target="_blank">微软新推社交网站Windows Live Planet</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>IIS6.0服务器架站无法访问解决方案总结（转贴）</title><link>http://www.cnblogs.com/SW515/archive/2006/05/30/413242.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Tue, 30 May 2006 09:22:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2006/05/30/413242.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/413242.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2006/05/30/413242.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/413242.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/413242.html</trackback:ping><description><![CDATA[<p align=center><strong style="COLOR: #800000">原文地址：</strong><a href="http://www.weste.net/2005/1-10/09204593233.html">http://www.weste.net/2005/1-10/09204593233.html</a></p>
　　很多朋友在用IIS6架网站的时候遇到不少问题，而这些问题有些在过去的IIS5里面就遇到过，有些是新出来的，俺忙活了一下午，做了很多次试验，结合以前的排错经验，做出了这个总结，希望能给大家帮上忙
<p>　　如果你的服务器是2003的，它默认只支持.net,不支持asp所以须进行以下操作：打开iis6.0里面的本地计算机-&gt;web服务扩展把active server pages&nbsp; 允许就行了。</p>
<p><strong>问题1：未启用父路径</strong></p>
<p>症状举例：</p>
<p>Server.MapPath() 错误 'ASP 0175 : 80004005' <br>不允许的 Path 字符 <br>/0709/dqyllhsub/news/OpenDatabase.asp，行 4 <br>在 MapPath 的 Path 参数中不允许字符 '..'。</p>
<p><strong>原因分析：</strong></p>
<p>　　许多Web页面里要用到诸如../格式的语句（即回到上一层的页面，也就是父路径），而IIS6.0出于安全考虑，这一选项默认是关闭的。</p>
<p>解决方法：</p>
<p>在IIS中 属性-&gt;主目录-&gt;配置-&gt;选项中。把&#8221;启用父路径&#8220;前面打上勾。确认刷新。 </p>
<p><strong>问题2：ASP的Web扩展配置不当（同样适用于ASP.NET、CGI）</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 404 - 文件或目录未找到。</p>
<p><strong>原因分析：</strong></p>
<p>　　在IIS6.0中新增了web程序扩展这一选项，你可以在其中对ASP、ASP.NET、CGI、IDC等程序进行允许或禁止，默认情况下ASP等程序是禁止的。</p>
<p>解决方法：</p>
<p>　　在IIS中的Web服务扩展中选中Active Server Pages，点击&#8220;允许&#8221;。</p>
<p><strong>问题3：身份认证配置不当</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 401.2 - 未经授权：访问由于服务器配置被拒绝。</p>
<p><strong>原因分析：IIS 支持以下几种 Web 身份验证方法：</strong></p>
<p>匿名身份验证</p>
<p>　　IIS 创建 IUSR_计算机名称 帐户（其中 计算机名称 是正在运行 IIS 的服务器的名称），用来在匿名用户请求 Web 内容时对他们进行身份验证。此帐户授予用户本地登录权限。你可以将匿名用户访问重置为使用任何有效的 Windows 帐户。</p>
<p>基本身份验证</p>
<p>　　使用基本身份验证可限制对 NTFS 格式 Web 服务器上的文件的访问。使用基本身份验证，用户必须输入凭据，而且访问是基于用户 ID 的。用户 ID 和密码都以明文形式在网络间进行发送。</p>
<p>Windows 集成身份验证</p>
<p>　　Windows 集成身份验证比基本身份验证安全，而且在用户具有 Windows 域帐户的内部网环境中能很好地发挥作用。在集成的 Windows 身份验证中，浏览器尝试使用当前用户在域登录过程中使用的凭据，如果尝试失败，就会提示该用户输入用户名和密码。如果你使用集成的 Windows 身份验证，则用户的密码将不传送到服务器。如果该用户作为域用户登录到本地计算机，则他在访问此域中的网络计算机时不必再次进行身份验证。</p>
<p>摘要身份验证</p>
<p>　　摘要身份验证克服了基本身份验证的许多缺点。在使用摘要身份验证时，密码不是以明文形式发送的。另外，你可以通过代理服务器使用摘要身份验证。摘要身份验证使用一种挑战/响应机制（集成 Windows 身份验证使用的机制），其中的密码是以加密形式发送的。</p>
<p>.NET Passport 身份验证</p>
<p>　　Microsoft .NET Passport 是一项用户身份验证服务，它允许单一签入安全性，可使用户在访问启用了 .NET Passport 的 Web 站点和服务时更加安全。启用了 .NET Passport 的站点会依靠 .NET Passport 中央服务器来对用户进行身份验证。但是，该中心服务器不会授权或拒绝特定用户访问各个启用了 .NET Passport 的站点。</p>
<p>解决方法：</p>
<p>　　根据需要配置不同的身份认证（一般为匿名身份认证，这是大多数站点使用的认证方法）。认证选项在IIS的属性-&gt;安全性-&gt;身份验证和访问控制下配置。</p>
<p><strong>问题4：IP限制配置不当</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 403.6 - 禁止访问：客户端的 IP 地址被拒绝。</p>
<p><strong>原因分析：</strong></p>
<p>　　IIS提供了IP限制的机制，你可以通过配置来限制某些IP不能访问站点，或者限制仅仅只有某些IP可以访问站点，而如果客户端在被你阻止的IP范围内，或者不在你允许的范围内，则会出现错误提示。</p>
<p>解决方法：</p>
<p>　　进入IIS的属性-&gt;安全性-&gt;IP地址和域名限制。如果要限制某些IP地址的访问，需要选择授权访问，点添加选择不允许的IP地址。反之则可以只允许某些IP地址的访问。</p>
<p><strong>问题5：IUSR账号被禁用</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 401.1 - 未经授权：访问由于凭据无效被拒绝。</p>
<p><strong>原因分析：</strong></p>
<p>　　由于用户匿名访问使用的账号是IUSR_机器名，因此如果此账号被禁用，将造成用户无法访问。</p>
<p>解决办法：</p>
<p>　　控制面板-&gt;管理工具-&gt;计算机管理-&gt;本地用户和组，将IUSR_机器名账号启用。</p>
<p><br><strong>问题6：NTFS权限设置不当</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 401.3 - 未经授权：访问由于 ACL 对所请求资源的设置被拒绝。</p>
<p><strong>原因分析：</strong></p>
<p>　　Web客户端的用户隶属于user组，因此，如果该文件的NTFS权限不足（例如没有读权限），则会导致页面无法访问。</p>
<p>解决办法：</p>
<p>　　进入该文件夹的安全选项卡，配置user的权限，至少要给读权限。关于NTFS权限设置这里不再馈述。</p>
<p><strong>问题7：IWAM账号不同步</strong></p>
<p>症状举例：</p>
<p>HTTP 500 - 内部服务器错误</p>
<p><strong>原因分析：</strong></p>
<p>　　IWAM账号是安装IIS时系统自动建立的一个内置账号。IWAM账号建立后被Active Directory、IIS metabase数据库和COM+应用程序三方共同使用，账号密码被三方分别保存，并由操作系统负责这三方保存的IWAM密码的同步工作。系统对IWAM账号的密码同步工作有时会失效，导致IWAM账号所用密码不统一。</p>
<p>解决办法：</p>
<p>　　如果存在AD，选择开始-&gt;程序-&gt;管理工具-&gt;Active Directory用户和计算机。为IWAM账号设置密码。</p>
<p>运行c:\Inetpub\AdminScripts&gt;adsutil SET w3svc/WAMUserPass +密码 同步IIS metabase数据库密码<br>运行cscript c:\inetpub\adminscripts\synciwam.vbs -v 同步IWAM账号在COM+应用程序中的密码</p>
<p><strong>问题8：MIME设置问题导致某些类型文件无法下载（以ISO为例）</strong></p>
<p>症状举例：</p>
<p>HTTP 错误 404 - 文件或目录未找到。</p>
<p><strong>原因分析：</strong></p>
<p>　　IIS6.0取消了对某些MIME类型的支持，例如ISO，致使客户端下载出错。</p>
<p>解决方法：</p>
<p>　　在IIS中 属性-&gt;HTTP头-&gt;MIME类型-&gt;新建。在随后的对话框中，扩展名填入.ISO，MIME类型是application。</p>
<p>　　另外，防火墙阻止，ODBC配置错误，Web服务器性能限制，线程限制等因素也是造成IIS服务器无法访问的可能原因，这里就不再一一馈述了。希望此帖能解决大家的大部分问题：）</p>
<img src ="http://www.cnblogs.com/SW515/aggbug/413242.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47960/" target="_blank">火狐3.5版被指推出太匆忙：存在50多个漏洞</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>BugTracker.NET 汉化手札</title><link>http://www.cnblogs.com/SW515/archive/2005/11/29/286619.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Tue, 29 Nov 2005 01:06:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2005/11/29/286619.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/286619.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2005/11/29/286619.html#Feedback</comments><slash:comments>14</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/286619.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/286619.html</trackback:ping><description><![CDATA[<p style="FONT-WEIGHT: bold; FONT-SIZE: 14pt; FONT-FAMILY: 黑体; TEXT-ALIGN: center"><font face=Arial>BugTracker.NET</font> 汉化手札 </p>
<div style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">
<p style="FONT-SIZE: 16pt; MARGIN-BOTTOM: 0px; FONT-FAMILY: 仿宋_GB2312"><b>引 言</b> </p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　在以前的公司就曾推荐在项目组中用 <span style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial"><a href="http://btnet.sourceforge.net/" target=_blank>BugTracker.net</a></span>（错误跟踪管理 <font color=#ff0000>★<b>开源</b>★</font> <i>直到现在他们仍然在使用</i>），最近自己需要对一个网站项目进行错误跟踪管理，自然就又想到了它。上网下载了个<a href="http://btnet.sourceforge.net/" target=_blank>最新版本2.1.4</a>(2005/10/22)。 <br></p>
<p style="MARGIN-TOP: 5px">　　因为现在需要将其部署在公共Web服务器上让普通用户使用 BugTracker 来报告错误，所以必须将其进行汉化并调整其默认的安全策略。 </p>
<p style="FONT-SIZE: 16pt; MARGIN-BOTTOM: 0px; FONT-FAMILY: 仿宋_GB2312"><b>简 介</b> </p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　<a href="http://btnet.sourceforge.net/" target=_blank>BugTracker.net</a> 是用C#写的一个基于ASP.net的开源项目，是一款简单易用的<b>错误跟踪管理</b>软件。 </p>
<p style="FONT-SIZE: 16pt; MARGIN-BOTTOM: 0px; FONT-FAMILY: 仿宋_GB2312"><b>安 装</b> </p>
<p style="MARGIN-TOP: 5px"></p>
<ol style="MARGIN-TOP: 5px">
    <li>将下载的压缩文件全部解压缩到某个文件夹中（譬如&#8220;E:\BugTracker&#8221;）。
    <li>创建数据库（譬如&#8220;BugTracker&#8221;），然后打开『SQL查询分析器』执行下载压缩文件内的&#8220;setup.sql&#8221;既可。
    <li>打开『IIS信息服务管理器』在&#8220;默认网站&#8221;下面创建虚拟目录（譬如&#8220;BugTracker&#8221;），并对应到你的物理目录（譬如&#8220;E:\BugTracker&#8221;）。将&#8220;default.aspx&#8221;添加到默认文件列表中。
    <li>打开浏览器在地址栏输入&#8220;http://127.0.0.1/BugTracker&#8221;，使用默认的系统管理员（Admin）帐号登录使用。 </li>
</ol>
<p>&nbsp;</p>
<p style="FONT-SIZE: 16pt; MARGIN-BOTTOM: 0px; FONT-FAMILY: 仿宋_GB2312"><b>汉 化</b> </p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　BugTracker 项目的源代码和页面标签是混合在一起的而没有使用Codebehind，就像又回到了ASP时代一样。所以你千万不要像我一样到处找代码文件，我一度还以为它没提供源代码呢。坦白说，该项目的设计和代码实现都不咋的<i>（看来，老外也不尽都是强人啊）</i>，远没有 <a href="http://bbs.hidotnet.com/" target=_blank>ASP.net Forums（中文版）</a> 来得漂亮，当然也可能是因为这两个项目的复杂度相差太大而导致设计思路不同罢。 </p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　该项目没有使用资源文档，各种显示文本/链接资源等均是硬编码在ASPX页面文件中的，所以我们必须一个个打开相关的ASPX文件，找到显示的英文内容后将其一一修改成中文，然后保存就可以了。因为是使用代码混合的方式，所以连编译这个步骤都可省略了（<i>&#8220;可见即可得&#8221;</i>）。 </p>
<p style="MARGIN-TOP: 10px; MARGIN-BOTTOM: 2px">　　该项目中包含两个可能导致安全隐患的页面： </p>
<ol style="MARGIN-TOP: 5px">
    <li><font color=#ff0000><b>query.aspx</b></font> 页面是用来直接运行SQL语句的，这会导致非常严重的安全隐患，尤其是将该项目部署到公共服务器上面，一定要将该页面文件删除，否则不怀好意的人就可以利用其执行危险的SQL命令了！！！
    <li><font color=#ff0000><b>view_web_config.aspx</b></font> 页面通过它能查看 Web.config 内容，这实在是个非常糟糕的事情。因为数据库连接字符串都是未经加密就直接保存在 Web.config 文件中的，如果你未删除该页面那后果可想而知了罢？！ </li>
</ol>
　　在该汉化版本中，我将配置文件中的某些选项改成更安全的设置了。并且将 Web.config 配置文件改成了UTF-8编码方式以支持使用中文。另外，配置文件中的&#8220;UploadFolder&#8221;键和&#8220;LogFileFolder&#8221;键值必须指定的是绝对物理路径而不是虚拟路径，所以如果你要将该项目部署到公共服务器中，可能需要写个测试页面以得到你当前虚拟目录对应的物理路径（譬如[C#]：<font face="Courier New" color=#000080>Response.Write(Server.MapPath("."));</font>），然后将该物理路径更新到配置文件中的该健值。 <br>　　经过一段时间的测试运行后，发现其日志文件增长较快，便将本 Web.config 配置文件内的是否启用日志记录选项（LogEnabled="0"）设成关闭了。
<p>&nbsp;</p>
<p style="FONT-SIZE: 16pt; MARGIN-BOTTOM: 0px; FONT-FAMILY: 仿宋_GB2312"><b>其 他</b> </p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　本人英文水平很菜，如果有翻译的辞不达意的地方敬请各位来信告知：<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#119;&#53;&#49;&#53;&#64;&#50;&#49;&#99;&#110;&#46;&#99;&#111;&#109;">SW515@21cn.com</a>，我将及时更正！ <br></p>
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px">　　下载 BugTracker.NET 2.1.4(汉化版)：</p>
<ul>
    <li><a href="http://www.zongsoft.com/Download/BugTracker(2.1.4)cn.rar">http://www.zongsoft.com/Download/BugTracker(2.1.4)cn.rar</a>
    <li><a href="http://www.totogogo.com/Zongsoft/Download/BugTracker(2.1.4)cn.rar">http://www.totogogo.com/Zongsoft/Download/BugTracker(2.1.4)cn.rar</a> </li>
</ul>
<p style="BORDER-RIGHT: navy 1px solid; BORDER-TOP: navy 1px solid; MARGIN-TOP: 80px; FONT-SIZE: 12pt; BORDER-LEFT: navy 1px solid; COLOR: red; TEXT-INDENT: 2em; BORDER-BOTTOM: navy 1px solid; FONT-FAMILY: 仿宋_GB2312; BACKGROUND-COLOR: yellow"><font face=黑体><b><u>声明</u>：</b></font>本人对该汉化版本不承担任何法律上的责任和义务，如果因为该系统造成您的一切损失都与本人无关，敬请自酌！ </p>
<div style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; FONT-SIZE: 12pt; BORDER-LEFT: gray 1px solid; COLOR: navy; BORDER-BOTTOM: gray 1px solid; BACKGROUND-COLOR: #dddddd">
<p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 15px; COLOR: red" align=center><b><u>如果转载本文敬请完整保留该段信息！</u></b> </p>
<span style="FONT-SIZE: 12pt; FONT-FAMILY: 楷体_GB2312">作者：钟峰，2005年11月28日</span> <br><br><span style="FONT-SIZE: 12pt; FONT-FAMILY: 仿宋_GB2312">博　　客：</span><a href="http://sw515.cnblogs.com/" target=_blank>http://SW515.cnblogs.com/</a> <br><span style="FONT-SIZE: 12pt; FONT-FAMILY: 仿宋_GB2312">公司网站：</span><a href="http://www.zongsoft.com/" target=_blank>http://www.Zongsoft.com/</a> </div>
</div>
<img src ="http://www.cnblogs.com/SW515/aggbug/286619.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47959/" target="_blank">Google对手机搜索进行优化升级</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>PostgreSQL 与 SQL Server 的数据类型映射</title><link>http://www.cnblogs.com/SW515/archive/2005/11/12/274493.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Fri, 11 Nov 2005 17:25:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2005/11/12/274493.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/274493.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2005/11/12/274493.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/274493.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/274493.html</trackback:ping><description><![CDATA[<H3>前言</H3>
<P>　　PostgreSQL 8.1 轰动发布，我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上，首先需要迁移的是表，那么这就必须要先搞清楚这两个数据库中的数据类型的映射关系。查了下 PostgreSQL 文档特制作如下对应表格，以飨各位。</P>
<HR>
<P>&nbsp;</P>

<TABLE align="center" border="1" cellspacing="0" cellpadding="2" bordercolordark="#FFFFFF"
bordercolorlight="#808080" style="font-family:Courier New,Arial, 宋体; font-size:10pt;">
<TR valign="top" bgcolor="#C0C0C0">
 <TH width="33%">SQL Server 2000</TH>
 <TH width="33%">Microsoft Jet-SQL 4.0</TH>
 <TH width="33%">PostgreSQL 8.x</TH>
</TR>
<TR valign="top">
 <TD style="color:navy">bigint</TD>
 <TD>DECIMAL</TD>
 <TD>bigint</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">binary<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>BINARY(<I>n</I>)</TD>
 <TD>bytea(<I>n</I>)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">bit</TD>
 <TD>BIT</TD>
 <TD>boolean, bool</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">char<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>CHAR(<I>n</I>)</TD>
 <TD>char(<I>n</I>)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">datetime</TD>
 <TD>DATETIME</TD>
 <TD>timestamp(date, time)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">decimal</TD>
 <TD>DECIMAL</TD>
 <TD>decimal</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">float</TD>
 <TD>FLOAT</TD>
 <TD>real, float4</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">image</TD>
 <TD>IMAGE</TD>
 <TD>bytea</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">int</TD>
 <TD>INT</TD>
 <TD>integer, int, int4</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">money</TD>
 <TD>CURRENCY</TD>
 <TD>decimal</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">nchar<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>NCHAR(<I>n</I>)</TD>
 <TD>char(<I>n</I>)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">ntext</TD>
 <TD>LONGTEXT</TD>
 <TD>text</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">numeric</TD>
 <TD>DECIMAL</TD>
 <TD>numeric</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">nvarchar<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>NCHAR VARYING(<I>n</I>)</TD>
 <TD>varchar(<I>n</I>)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">real</TD>
 <TD>REAL</TD>
 <TD>real</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">smalldatetime</TD>
 <TD>DATETIME</TD>
 <TD>timestamp(date, time)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">smallint</TD>
 <TD>SMALLINT</TD>
 <TD>smallint, int2</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">smallmoney</TD>
 <TD>CURRENCY</TD>
 <TD>decimal</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">text</TD>
 <TD>LONGTEXT</TD>
 <TD>text</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">timestamp</TD>
 <TD>BINARY</TD>
 <TD><FONT color="gray"><I>无</I></FONT></TD>
</TR>
<TR valign="top">
 <TD style="color:navy">tinyint</TD>
 <TD>BYTE</TD>
 <TD><FONT color="gray"><I>无</I></FONT></TD>
</TR>
<TR valign="top">
 <TD style="color:navy">uniqueidentifier</TD>
 <TD>GUID</TD>
 <TD><FONT color="gray"><I>无</I></FONT></TD>
</TR>
<TR valign="top">
 <TD style="color:navy">varbinary<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>VARBINARY(<I>n</I>)</TD>
 <TD>bytea(<I>n</I>)</TD>
</TR>
<TR valign="top">
 <TD style="color:navy">varchar<FONT color="gray">(<I><FONT color="black">n</FONT></I>)</FONT></TD>
 <TD>VARCHAR(<I>n</I>)</TD>
 <TD>varchar(<I>n</I>)</TD>
</TR>
</TABLE>
<P>
<B>注意:</B><U>PostgreSQL 中的 <FONT color="maroon">money</FONT>（货币）数据类型现在已经废弃，用 numeric 或 decimal 以及和 to_char 函数一起使用就可以取代它。</U>
</P>
<P>
* SQL Server 中的 <SPAN style="color:navy">datetime</SPAN>、<SPAN style="color:navy">smalldatetime</SPAN> 数据类型均包含日期和时间部分，区别只在于精度不同。其对应于 PostgreSQL 中的 <SPAN style="color:maroon">timestamp</SPAN> 类型（包含日期和时间）。在 PostgreSQL 中如果只需要日期部分，则可以使用 <SPAN style="color:maroon">date</SPAN> 类型，而只需要时间部分则可使用 <SPAN style="color:maroon">time</SPAN> 类型。
</P>
<P>
* PostgreSQL 中的 <SPAN style="color:maroon">bytea</SPAN>(<I>n</I>) 始终为变长的二进制字节数组，相当于 SQL Server 中的 <SPAN style="color:navy">varbinary</SPAN>(<I>n</I>)，如果没有指定 <SPAN style="color:maroon">bytea</SPAN> 的最大字节数则表示为不限长度的变长字节数组，相当于 SQL Server 中的 <SPAN style="color:navy">image</SPAN> 数据类型。
</P>
<P>
* PostgreSQL 中的字符类型没有像 SQL Server 中有对应的本地文本类型和国际化文本类型的两种文本数据类型的区别，存储在 PostgreSQL 中的文本类型的数据是否国际化还是本地化取决于数据库的文本编码设置。<BR>
<I>　　为了保证数据存储的国际化，建议将数据库的文本编码方式设置为 UTF-8 或者 Unicode，以确保存储的文本可被不同地区和文化下的用户查看和存储。</I>
</P>
<P>
* 对于 GUID 类型的数据，在 PostgreSQL 中可以使用 <SPAN style="color:maroon">bytea</SPAN>(16) 来保存，可用字节数组函数来对其进行比较等操作。
</P> <img src ="http://www.cnblogs.com/SW515/aggbug/274493.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47958/" target="_blank">风声又起 Windows 7 RTM版7月13日完成</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>辞职了……</title><link>http://www.cnblogs.com/SW515/archive/2005/09/29/247011.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Thu, 29 Sep 2005 15:11:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2005/09/29/247011.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/247011.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2005/09/29/247011.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/247011.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/247011.html</trackback:ping><description><![CDATA[<FONT color=#a52a2a>　　今天上午交了辞职信，下午Perth找我谈了很久，说得我心情有些郁闷。不管怎样，理想总是要坚持的，代价也必须要付出的！<BR><BR>　　只是希望这个决定不会又是一个错误的抉择吧，阿门！<BR><BR><BR><BR><BR></FONT><FONT color=#808080 size=2><FONT color=#a52a2a></FONT><IMG height=20 src="http://www.cnblogs.com/Emoticons/QQ/06.gif" width=20 border=0>其实心里还是有些舍不得，不知道是难舍什么，可能是在一个地方呆久了吧，亦或许是因为我真的老了&#8230;&#8230;<BR></FONT><BR><BR><FONT color=#000080>　　不知不觉中在HTF干了两年半了，虽然公司有诸多的不完善处，但是事情毕竟总是在朝着良性方面发展<EM><FONT color=#808080>（最郁闷的是俺的期权啊，木有咧～<IMG alt=icon18 src="http://www.cnblogs.com/Emoticons/QQ/icon18.gif" border=0>）</FONT></EM>，正如BOSS说得那样，高速发展中的公司提供了不可限量的机会和挑战，对于这点我是深表认同的。唉～ 不说咧，一句话，</FONT><FONT color=#ff0000><STRONG>希望继续留守的兄弟们越走越好吧！</STRONG></FONT> <img src ="http://www.cnblogs.com/SW515/aggbug/247011.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47957/" target="_blank">乔布斯和埃利森</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item><item><title>PostgreSQL 8.0.2 应用报告</title><link>http://www.cnblogs.com/SW515/archive/2005/04/26/145322.html</link><dc:creator>SW515</dc:creator><author>SW515</author><pubDate>Tue, 26 Apr 2005 01:20:00 GMT</pubDate><guid>http://www.cnblogs.com/SW515/archive/2005/04/26/145322.html</guid><wfw:comment>http://www.cnblogs.com/SW515/comments/145322.html</wfw:comment><comments>http://www.cnblogs.com/SW515/archive/2005/04/26/145322.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cnblogs.com/SW515/comments/commentRss/145322.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/SW515/services/trackbacks/145322.html</trackback:ping><description><![CDATA[<div style="FONT-SIZE: 11pt; FONT-FAMILY: 宋体">
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">概述</p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">PostgreSQL 8.0.2 已经正式发布，该版本被官方建议广泛使用，从8.0开始增加了对 Windows2K/XP 平台的直接支持，并随安装包附带了 pgAdmin III 图形界面的数据库管理工具（开源），您可以通过该图形管理界面创建数和操作据库、表空间、模式(Schema)等各种数据库对象。<font color="#000080"><b>注：</b><i>在本文中所引述的 PostgreSQL 均是指 8.0.2 for Windows 的版本。</i></font> 
       </p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">安装</p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">安装 Windows 版本的 PostgreSQL 服务器是非常简单的，首先从官方网站下载安装包，然后执行 postgresql-8.0.msi 安装文件，跟着提示一步步走就可以了。其中需要设置 PostgreSQL 的Windows服务的密码和超级用户 postgres 的密码，密码均不能为空！<font color="#800000"><b>另外，PostgreSQL 8.0.2 必须安装在 NTFS 格式的分区中。</b></font> 
       </p><span style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">使用</span> 
<br/>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">安装完成后，默认已经启动了 PostgreSQL 的服务，您只需从&#8220;<b><u>开始</u></b>&#8221;－&#8220;<b><u>程序</u></b>&#8221;－&#8220;<b><u>PostgreSQL 8.0</u></b>&#8221;菜单中运行&#8220;<b>pgAdmin III</b>&#8221;即可使用图形化管理界面进行各种数据库操作了。 
       </p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">开发</p><span style="FONT-WEIGHT: bold; FONT-SIZE: 12pt">　　一、对中文的支持</span> 
       <p style="MARGIN-TOP: 5px">　　再创建数据库时，建议指定编码方式为：UNICODE(UTF-8)，在客户端连接字符串中显式指定 <font face="Courier New" color="#000080">Encoding=UNICODE</font>，否则可能出现读写多字节字符时出现乱码。 
       </p><span style="FONT-WEIGHT: bold; FONT-SIZE: 12pt">　　二、大小写的问题</span> 
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">由于 PostgreSQL 是大小写敏感的，并默认对SQL语句中的数据库对象名称转换为小写，因此如果你在创建数据库对象时指定了大小写混和的对象名称，那么在通过SQL语句访问这些对象时，必须使用双引号（&quot;）将数据库对象括起来，以提示 PostgreSQL 不用帮你转换对象名为小写，否则将激发<font color="#800000"><i>&#8220;xxxxx对象不存在&#8221;</i></font>的异常，譬如您的数据库中有名为 TUser 的表，您在 PostgreSQL 自带的图形化查询工具中必须使用类似这样的查询语句才能正确执行：<font face="Courier New" color="#000080">SELECT * FROM &quot;TUser&quot;</font>，当然它对 SQL 标准中的保留字和关键字是不区分大小写的，所以写成 <font face="Courier New" color="#000080">select * From &quot;TUser&quot;</font> 这样也是完全可以的。 
       </p>
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">　　另外，PostgreSQL 对数据也是大小写敏感的，这点与 SQLServer 不同（SQLServer 默认是不敏感的），譬如在 TUser 表中有字段 Name，其中有一行 Name 字段值为&#8220;Tony Tang&#8221;的记录，如果直接使用 
<br/>
       </p><center><font face="Courier New" color="#000080">SELECT * FROM &quot;TUser&quot; WHERE &quot;Name&quot; LIKE &#39;%tony%&#39;;</font></center>是查询不到这条记录的，不过你可以这么写： 
<br/><center><font face="Courier New" color="#000080">SELECT * FROM &quot;TUser&quot; WHERE UPPER(&quot;Name&quot;) LIKE &#39;%TONY%&#39;;</font></center>
       <p></p>
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">　　呵呵，是不是觉得这样不太好看，而且担心性能会受影响？幸好 PostgreSQL 提供了关键字 <font face="Courier New" color="#000080">ILIKE</font> 来帮我们解决这个问题，这真是个非常有趣的关键字（I like），对于第一种写法只需要将 <font face="Courier New" color="#000080"><b>LIKE</b></font> 替换成 <font face="Courier New" color="#800000"><b>ILIKE</b></font> 就可以了。 
       </p>
       <p style="MARGIN-TOP: 20px; TEXT-INDENT: 2em">最后，建议在编写 SQL 脚本的时候，使用单引号做字符串常量的标识，虽然在 MS SQLServer 中双引号和单引号均可作为字符串常量的标识符，但是在 PostgreSQL 中对此就有严格的功能区分（不能用双引号作为字符串常量的标识符），为了保险起见，建议对所有的数据库对象名均使用双引号（&quot;）将其显式约定，以保证大小写的严格匹配。 </p>
       <p></p><span style="FONT-WEIGHT: bold; FONT-SIZE: 12pt">　　三、.NET 开发问题</span> 
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">首先您可以从<a href="http://gborg.postgresql.org/project/npgsql/download/download.php?branch=devel" target="_blank">这里</a>下载 PostgreSQL 的 .NET Data Provider 程序，本文附带提供的 Demo 是基于 Npgsql0.7beta5 开发的，对此需要特别说明的是，发布客户端程序只需要附带 <font face="Arial" color="#800000"><b>Npgsql.dll</b></font> 和 <font face="Arial" color="#800000"><b>Mono.Security.Protocol.Tls.dll</b></font> 这两个动态库就可以了，完全不需要再安装任何其他 PostgreSQL 客户端类库！ 真可谓<font color="#008000"><b><i>绿色环保</i></b></font>啊～ 
       </p>
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">在 .NET 中通过 ADO.net 来访问 PostgreSQL 数据库简直就是一种享受，尤其是那些习惯使用了 MS-SQL Server 的开发者，因为无论编写 PostgreSQL 的函数（存储过程）还是调用这些函数都和 SQLServer 大致一样，尤其是对返回数据集的编码方式与 SQLServer 完全一样，根本没有像访问 Oracle 存储过程返回的数据集要使用引用游标那样麻烦，所以在这方面对这两种数据库访问代码的移植是非常容易的！ 
<br/>
       </p>
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; TEXT-INDENT: 2em">通过 DataAdapter 对象的 Fill 方法调用返回多个表的SQL操作，那么它也会自动填充相应的多个 DataTable 到 DataSet 中，这点与操作 MS-SQL Server 完全一样。<i>本文提供了 .NET 中操作 PostgreSQL 的范例，请从本文的<font color="#800000"><u>范例下载</u></font>部分去下载。</i> 
       </p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">其他</p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">通过『任务管理器』可以看到启动了多个&#8220;postgres.exe&#8221;进程，请勿须惊慌，其中至少有四个是属于 PostgreSQL 系统服务的进程，目前 Windows 版本的 PostgreSQL 由于代码移植方面的问题，在多用户连接时也会对应的创建多个该进程，不过我个人认为该特性或许会在后续的版本中改进（毕竟 for Windows 版本才刚发布），如果你打算现在就在商业产品中应用该数据库，个人建议您使用 Linux/Unix 的版本。 </p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">默认情况下，您只能使用 127.0.0.1 来作为连接服务器的地址，如果想要从其他机器连接，必须修改 PostgreSQL 服务器上的 <span style="COLOR: blue; FONT-FAMILY: Courier New">pg_hba.conf</span> 和 <span style="COLOR: blue; FONT-FAMILY: Courier New">postgresql.conf</span> 这两个配置文件中的内容，其位于 <i>$PostgresSQL$</i>\8.0\data 中。 
       </p>
       <ul>
           <li>用记事本打开 postgresql.conf 文件后，将 listen_addresses 配置项释放出来改为：<span style="COLOR: blue; FONT-FAMILY: Courier New">listen_addresses = &#39;*&#39;</span> 
           </li>
           <li>用记事本打开 pg_hba.conf 文件后，在 # IPv4 local connections 下新增如下行： 
<br/><span style="COLOR: blue; FONT-FAMILY: Courier New">host&#160;&#160;&#160;&#160;all&#160;&#160;&#160;&#160;all&#160;&#160;&#160;&#160;192.168.0.0/24&#160;&#160;&#160;&#160;&#160;&#160;md5</span> 
<br/>
<br/>这表示 PostgreSQL 允许 IP 地址为 192.168.0.* 的任何主机与服务器中的所有数据库相连。 
           </li>
       </ul>
       <p></p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">总结</p>
       <p style="MARGIN-TOP: 5px; MARGIN-BOTTOM: 0px; TEXT-INDENT: 2em">PostgreSQL 的高贵出身以及辉煌的历史，加之它与生俱来的众多企业数据库的特性使得它成为开源数据库中最具商业化可能的一个，另外非常重要的一个是 PostgreSQL 众多的开发接口非常利于开发者对它的选用。开源之风已经吹入了数据库这块封闭的企业应用的核心地域了，譬如<a href="http://www.csdn.net/news/newstopic/20/20468.shtml" target="_blank">《数据库产品开源趋势突显 IBM甲骨文倍感压力》</a>，再则，企业应用也开始纷纷考虑起跨平台（譬如<a href="http://www.informationweek.com.cn/index.asp?INCName=mdarticlecontent&amp;ArticleID=214" target="_blank">《ERP的第三种选择 》</a>）了。 
       </p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em">先且不论跨平台、使用开源数据库是否会降低企业应用的总成本，但至少会给客户多一种选择，这无论是从市场开发还是应用适应的角度上讲，都是非常有积极意义的。<font color="#ff0000"><i>试想 <font face="Arial">Linux + Mono/.NET + PostgreSQL = ERP/Any Enterprise Applications</font>，呵呵，这真是多么令人激动的组合啊！</i></font> 
       </p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">范例下载</p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em"></p>
       <ol start="1" style="MARGIN-BOTTOM: 5px">
           <li>范例数据库：<a href="http://www.zongsoft.com/Download/PostgreSQL_Demo_db.rar" target="_blank">http://www.Zongsoft.com/Download/PostgreSQL_Demo_db.rar</a> 
           </li>
           <li>执行文件下载：<a href="http://www.zongsoft.com/Download/PostgreSQL_Demo_bin.rar" target="_blank">http://www.Zongsoft.com/Download/PostgreSQL_Demo_bin.rar</a> 
           </li>
           <li>源代码下载：<a href="http://www.zongsoft.com/Download/PostgreSQL_Demo_src.rar" target="_blank">http://www.Zongsoft.com/Download/PostgreSQL_Demo_src.rar</a> 
           </li>
       </ol>
       <p style="MARGIN-TOP: 10px; TEXT-INDENT: 2em"><u>PostgreSQL_Demo_db.rar</u> 文件中包含的 CreateDB.sql 是创建范例程序所需的数据库的 SQL 脚本文件，您可以在 psql 中执行如下命令来执行之：\i CreateDB.sql 或者通过执行里面的 CreateDB.bat 来自动创建。 
       </p>
       <p></p>
       <p style="FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-FAMILY: 黑体">资源链接</p>
       <p style="MARGIN-TOP: 5px; TEXT-INDENT: 2em"></p>
       <ol start="1">
           <li>PostgreSQL 官方网站：<a href="http://www.postgresql.org/" target="_blank">http://www.postgreSQL.org</a> 
           </li>
           <li>PostgreSQL 中文网站：<a href="http://www.pgsqldb.org/" target="_blank">http://www.pgsqldb.org</a> 
           </li>
           <li>PostgreSQL 中文论坛：<a href="http://bbs.pgsqldb.com/index.php" target="_blank">http://bbs.pgsqldb.com/index.php</a> 
           </li>
           <li>《<a href="http://my.so-net.net.tw/seiliki/pgsql-advocacy2.html" target="_blank">为什么选用PostgreSQL，而不是Oracle？</a>》 
           </li>
       </ol>
       <p></p>
       <p style="MARGIN-TOP: 50px; FONT-WEIGHT: bold; MARGIN-BOTTOM: 5px">作者简介：</p>
       <p style="MARGIN-TOP: 0px; FONT-SIZE: 11pt; TEXT-INDENT: 2em; FONT-FAMILY: 宋体">钟峰(Popeye Zhong)目前是 <a href="http://www.htf.com.cn/">深圳恒泰丰科技公司</a> 的.NET开发组的架构设计人员。他曾经使用 C 语言做过图形程序设计，在相当长的一段时期内从事 COM/COM+ 组件的开发和设计工作，并且短暂的做过 Lotus/Notes 和 Dialogic 语音卡程序的开发，从2003年初开始使用.NET这个充满趣味和挑战的开发平台。感兴趣的除了企业应用架构设计、组件开发、安全、图像处理外还对汽车和枪械模型有浓厚的兴趣。如果希望与他联系，可访问 <a href="http://blog.csdn.net/SW515">http://blog.csdn.net/SW515</a> 或者EMail <a href="mailto:sw515@21cn.com">SW515@21cn.com</a> 。 
       </p>
   </div><img src ="http://www.cnblogs.com/SW515/aggbug/145322.html?type=1" width = "1" height = "1" /><br/><br/>--------------------------<br/>新闻：<a href="http://news.cnblogs.com/n/47956/" target="_blank">Xbox Live将投放Silverlight广告</a><br/>网站导航: <a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻</a>&nbsp;&nbsp;<a href="http://dotnet.cnblogs.com" target="_blank">.NET频道</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/q/" target="_blank">博问</a>&nbsp;&nbsp;<a href="http://space.cnblogs.com/ing/" target="_blank">闪存</a>&nbsp;&nbsp;<a href="http://zzk.cnblogs.com" target="_blank">找找看</a>]]></description></item></channel></rss>