﻿<?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>博客园-张逸:晴窗笔记</title><link>http://www.cnblogs.com/wayfarer/</link><description>

</description><language>zh-cn</language><lastBuildDate>Thu, 28 Aug 2008 14:00:45 GMT</lastBuildDate><pubDate>Thu, 28 Aug 2008 14:00:45 GMT</pubDate><ttl>60</ttl><item><title>TransactionScope Troubleshooting</title><link>http://www.cnblogs.com/wayfarer/archive/2008/07/23/1249665.html</link><dc:creator>张逸</dc:creator><author>张逸</author><pubDate>Wed, 23 Jul 2008 07:56:00 GMT</pubDate><guid>http://www.cnblogs.com/wayfarer/archive/2008/07/23/1249665.html</guid><wfw:comment>http://www.cnblogs.com/wayfarer/comments/1249665.html</wfw:comment><comments>http://www.cnblogs.com/wayfarer/archive/2008/07/23/1249665.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnblogs.com/wayfarer/comments/commentRss/1249665.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/wayfarer/services/trackbacks/1249665.html</trackback:ping><description><![CDATA[只要涉及到数据库的操作，那么使用事务就是难免的。如果我们使用LINQ to SQL作为数据访问层，那么LINQ提供的SubmitChanges()方法自身就包含了对事务的处理。当然，我们也可以利用System.Data.Common.<span style="color: rgb(43, 145, 175);">DbTransaction</span>对事务进行处理，我们可以调用DataContext中Connection的方法BeginTransaction()启动事务，然后根据情况进行回滚或提交。例如是这样一段代码：<br><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align="top"><span style="color: rgb(0, 0, 0);">LinqSampleDataContext&nbsp;context&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;LinqSampleDataContext();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align="top">System.Data.Common.DbTransaction&nbsp;trans&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><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align="top"></span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"><br><img id="Codehighlighter1_124_343_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_124_343_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_124_343_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_124_343_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_124_343_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_124_343_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_124_343_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_124_343_Open_Text').style.display='inline';" align="top"></span><span id="Codehighlighter1_124_343_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_124_343_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;context.Connection.Open();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;trans&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;context.Connection.BeginTransaction();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;context.Transaction&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;trans;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;context.Employees.InsertOnSubmit(emp);<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;context.SubmitChanges();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;trans.Commit();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top">}</span></span><span style="color: rgb(0, 0, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align="top"></span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);">&nbsp;(Exception&nbsp;ex)<br><img id="Codehighlighter1_365_425_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_365_425_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_365_425_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_365_425_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_365_425_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_365_425_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_365_425_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_365_425_Open_Text').style.display='inline';" align="top"></span><span id="Codehighlighter1_365_425_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_365_425_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(trans&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><img id="Codehighlighter1_392_423_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_392_423_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_392_423_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_392_423_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_392_423_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_392_423_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_392_423_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_392_423_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_392_423_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_392_423_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trans.Rollback();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top">}</span></span></div><br>然而，当我们在使用LINQ to SQL中时，往往会同时使用多个DataContext，此时我们就需要使用TransactionScope。例如：<br><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align="top"><span style="color: rgb(0, 0, 0);">&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;(TransactionScope&nbsp;scope&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;TransactionScope(TransactionScopeOption.RequiresNew))<br><img id="Codehighlighter1_106_1189_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_106_1189_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_106_1189_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_106_1189_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_106_1189_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_106_1189_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_106_1189_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_106_1189_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_106_1189_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_106_1189_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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><img id="Codehighlighter1_136_942_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_136_942_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_136_942_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_136_942_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_136_942_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_136_942_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_136_942_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_136_942_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_136_942_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_136_942_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">for</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;i&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);">;&nbsp;i&nbsp;</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">&nbsp;nominees.Count;&nbsp;</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">i)<br><img id="Codehighlighter1_212_736_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_212_736_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_212_736_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_212_736_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_212_736_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_212_736_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_212_736_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_212_736_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_212_736_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_212_736_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Backup&nbsp;newBackup&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;nominees[i];<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ticket&nbsp;ticket&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;tickets[i];<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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);">update&nbsp;the&nbsp;information&nbsp;of&nbsp;ticket<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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);">mainly&nbsp;add&nbsp;the&nbsp;information&nbsp;of&nbsp;employee;</span><span style="color: rgb(0, 128, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"></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;ticket.EmployeeID&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;newBackup.EmployeeID;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ticket.HaveNominated&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><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ticket.IsConfirmedByManager&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><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ticket.Status&nbsp;</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">&nbsp;TicketStatus.Enroll.ToString();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ticketAccessor.Update(ticket);<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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);">update&nbsp;the&nbsp;IsSubmit&nbsp;of&nbsp;backup;</span><span style="color: rgb(0, 128, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ChangeSubmitStatue(backup);<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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);">remove&nbsp;the&nbsp;record&nbsp;of&nbsp;nominee&nbsp;in&nbsp;backup&nbsp;table</span><span style="color: rgb(0, 128, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"></span><span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delete(nominees);<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);">&nbsp;(Exception&nbsp;ex)<br><img id="Codehighlighter1_988_1148_Open_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_988_1148_Open_Text').style.display='none'; document.getElementById('Codehighlighter1_988_1148_Closed_Image').style.display='inline'; document.getElementById('Codehighlighter1_988_1148_Closed_Text').style.display='inline';" align="top"><img id="Codehighlighter1_988_1148_Closed_Image" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" style="display: none;" onclick="this.style.display='none'; document.getElementById('Codehighlighter1_988_1148_Closed_Text').style.display='none'; document.getElementById('Codehighlighter1_988_1148_Open_Image').style.display='inline'; document.getElementById('Codehighlighter1_988_1148_Open_Text').style.display='inline';" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_988_1148_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255); display: none;"><img src="http://www.cnblogs.com/images/dot.gif"></span><span id="Codehighlighter1_988_1148_Open_Text"><span style="color: rgb(0, 0, 0);">{<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ThrowHelper.ThrowBackupException(</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">Finalizing&nbsp;occurs&nbsp;an&nbsp;error.&nbsp;The&nbsp;transcation&nbsp;will&nbsp;be&nbsp;rollback.</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&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);">false</span><span style="color: rgb(0, 0, 0);">;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: rgb(0, 0, 0);"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top"><br><img src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;scope.Complete();<br><img src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span></div>代码中，分别涉及到Update, Delete等操作，因此我们势必需要用事务，保证数据整体提交或整体回滚。在使用事务的时候，有一些前置条件是必备的。例如启动Distributed Transaction Coordinator服务，否则，就会抛出System.Data.SqlClient.SqlException异常，信息为："MSDTC on server '{Server Name}' is unavailable."。是的，很多资料都是这样描述的。然而，现实并没有这么简单。我们首先得考虑运行代码的机器是否与数据库所在的机器是同一台。这里所谓的启动Distributed Transaction Coordinator服务，实际上是要启动数据库服务器的服务。如果数据库与代码服务器是同一台，通过这样的设置就没有错误了。<br><br>当数据库与代码服务器分属两台机器呢？同样运行如上的代码，就会抛出System.Transactions.TransactionManagerCommunicationException异常。异常信息为："Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool."<br><br>这是一种通信错误，原因在于两台服务器之间的安全配置禁止了分布式事务。解决办法是在运行代码的服务器上，配置Component Services。方法如下：<br>1、在Run运行窗口中，输入dcomcnfg命令，这样就可以打开Component Services。<br>2、选择Component Services-&gt;Computers-&gt;My Computer；<br>3、右键单击My Computer，在弹出的快捷菜单中，选择“Properties”，然后点击MSDTC tab；<br>4、在MSDTC tab中，点击Security Configuration按钮；<br>5、在弹出的对话框中参照下表的建议进行设置：<br><table style="background-color: rgb(204, 204, 204);" border="1" width="100%"><tbody><tr><th>
Configuration Option
</th> <th>
Default Value
</th> <th>
Recommended Value
</th></tr><tr> <td> <p>Network DTC Access</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled</p> </td></tr><tr> <td> <p><b>Client and Administration</b></p> </td> <td> <p> </p> <br></td> <td> <p> </p> <br></td></tr><tr> <td> <p>Allow Remote Clients</p> </td> <td> <p>Disabled</p> </td> <td> <p>Disabled</p> </td></tr><tr> <td> <p>Allow Remote Administration</p> </td> <td> <p>Disabled</p> </td> <td> <p>Disabled</p> </td></tr><tr> <td> <p><b>Transaction Manager Communication</b></p> </td> <td> <p> </p> <br></td> <td> <p> </p> <br></td></tr><tr> <td> <p>Allow Inbound</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled</p> </td></tr><tr> <td> <p>Allow Outbound</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled</p> </td></tr><tr> <td> <p>Mutual Authentication Required</p> </td> <td> <p>Enabled</p> </td> <td> <p>Enabled
if all remote machines are running Win2K3 SP1 or XP SP2 or higher, and
are configured with “Mutual Authentication Required”.</p> </td></tr><tr> <td> <p>Incoming Caller Authentication Required</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled if running MSDTC on cluster.</p> </td></tr><tr> <td> <p>No Authentication Required</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled if remote machines are pre-Windows Server 2003 SP1 or pre- Windows XP SP2.</p> </td></tr><tr> <td> <p>Enable TIP</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled if running the BAM Portal.</p> </td></tr><tr> <td> <p>Enable XA Transactions</p> </td> <td> <p>Disabled</p> </td> <td> <p>Enabled
if communicating with an XA based transactional system such as when
communicating with IBM WebSphere MQ using the MQSeries adapter.</p></td></tr></tbody></table>最后的设置如截图：<br><div align="center"><img src="http://www.cnblogs.com/images/cnblogs_com/wayfarer/securityconfig.gif" alt="securityconfig.gif" border="0" height="429" width="432"><br></div>如果操作系统是Windows 2003，通常默认的设置就是正确的。不过我们在编写程序时，不管是Unit Test，还是其他测试，最频繁的还是在本机上运行。如果操作系统是Windows XP，就不得不进行这样的设置了。<br><img src ="http://www.cnblogs.com/wayfarer/aggbug/1249665.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41940/" target="_blank">[新闻]惠普139亿美元完成对EDS的收购</a>]]></description></item><item><title>中国最美丽的MVP</title><link>http://www.cnblogs.com/wayfarer/archive/2008/07/14/1242395.html</link><dc:creator>张逸</dc:creator><author>张逸</author><pubDate>Mon, 14 Jul 2008 04:55:00 GMT</pubDate><guid>http://www.cnblogs.com/wayfarer/archive/2008/07/14/1242395.html</guid><wfw:comment>http://www.cnblogs.com/wayfarer/comments/1242395.html</wfw:comment><comments>http://www.cnblogs.com/wayfarer/archive/2008/07/14/1242395.html#Feedback</comments><slash:comments>21</slash:comments><wfw:commentRss>http://www.cnblogs.com/wayfarer/comments/commentRss/1242395.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/wayfarer/services/trackbacks/1242395.html</trackback:ping><description><![CDATA[<img src="http://www.cnblogs.com/images/cnblogs_com/wayfarer/hmy.jpg" alt="hmy.jpg" align="left" border="0" height="533" width="400">胡铭娅(Michelle Hu)，IT168技术频道资深编辑，曾任电子工业出版社计算机图书事业部编辑，编辑出版了多本畅销计算机图书。2007年加入IT168技术频道，负责.NET、SQL Server等微软技术相关频道，以及IT人生、图书等栏目。专注于微软技术跟踪报道和推广，对.net技术有着独特的理解。<br><br><b>前面的话</b><br><br>谁说女子不如男，多有巾帼胜英雄。在微软MVP的大阵营里，自然不乏巾帼专家们的秀丽身影，她们在各自的领域以其过人的魅力与出类拔萃的能力赢得了尊重。在七月流火的季节里，微软公布了2008年度7月新一届MVP的名单。这其中作为IT168技术频道资深编辑的胡铭娅小姐的当选倍为引人注目。对于这样一位“美丽与智慧并重，时尚与技术前行”的美女MVP，以其在.NET技术领域中做出的卓越贡献，得到了微软MVP项目组的一致肯定，首次当选MVP。这位被誉为“中国最美丽的MVP”以其敏锐的视野、独特的见解、秀丽的文笔，有力地推动了.NET与SQL Server技术在中国，尤其是在技术社区的推广。<br><br>随着这一届MVP名单的新鲜出炉，笔者第一时间连线这位美女MVP，并有幸获得她的允许，与读者分享她的经历与体会。<br><br><b>采访手记</b><br><br><b>主持人</b>：胡铭娅小姐，首先恭喜你获得微软的MVP称号！可以先简单地介绍一下你自己吗？<br><b>胡铭娅</b>：谢谢。我主要从事于技术编辑工作，目前担任IT168技术频道资深编辑，之前曾任电子工业出版社计算机图书事业部编辑，在此期间，编辑出版了多本计算机畅销图书。2007年，我加入IT168技术频道，主要负责.NET、SQL Server等微软技术的相关频道，以及IT人生、图书等栏目。我非常专注于微软技术的跟踪报道和推广，同时对.NET技术有着独特的理解。<br><br><b>主持人</b>：据说你这次是北京市08年7月当选的唯一的一位女性MVP，在这里可否给大家谈谈你当选mvp时的感受吗？<br><b>胡铭娅</b>：感觉自己真的非常幸运。这首先得感谢微软能给我这个机会与荣誉，同时还要感谢身边的一些MVP朋友在技术上给予我的帮助。正是他们在初期引导我进入微软技术圈子，为我传道解惑，并时刻给我鼓励与帮助。<br><br><b>主持人</b>：请问你是何时进入IT行业的？能否谈谈你对这个行业的认识？<br><b>胡铭娅</b>：进入IT行业是我当初考大学时就决定了的。家长曾给我很多其它的建议，但是出于对计算机的爱好与兴趣，我仍然决定选择计算机专业。我在大学的时候曾经做过一个论坛，在那个时候还没有.NET技术，我记得当时是用ASP编写的。论坛维持了大约3年，后来一直为其不停地寻找服务器（因为支持ASP的空间不再免费）。由于学业比较繁忙，又面临毕业找工作等问题，就无奈放弃了。现在想来还有些后悔，因为在那个时候完全没有意识到他的商业价值，呵呵 :)<br><br>我在毕业之后一直希望能够从事与计算机相关的职业。2004年，一个偶然的机会，我来到了电子工业出版社计算机图书事业部，从此开始了我的IT人生之旅。<br><br>在我看来，IT行业是高新科技产业，一个不断创新的行业，也是智力密集型行业，当中的每一个人都要有清晰的头脑、敏锐的眼光、快速的反应和学习能力。IT 行业是目前中国和发达国家发展差距相对较小的产业。相信通过我们的不断努力，一定有机会追上，甚至超越发达国家的计算机水平。<br><br><b>主持人</b>：我们知道MVP是微软为那些在微软技术领域中作出突出贡献、在某个技术领域具有较高造诣，或者对于推广微软技术发挥巨大力量的技术人员所颁布的全球性奖项。对于从事微软技术开发的人员而言，可以说是微软官方能够授予的最高荣誉。对于一位新的MVP而言，你能谈谈对微软MVP的认识吗？<br><b>胡铭娅</b>：微软最有价值专家 (MVP)可以是：以微软技术为主题的作家、讲师、培训师；IT业界的业内知名专业人士，通过印刷媒体、博客或其它形式分享经验和观点的专家; 参与和微软技术有关的项目，担任主要角色的技术和管理人员; 建立讨论微软技术的技术网站，担任主要角色的技术和管理人员; 参与微软中文新闻组，积极地帮助论坛用户解决疑难问题的技术论坛高手；参与其他第三方的微软技术论坛，积极地帮助论坛用户解决疑难问题的技术论坛高手。<br>我现在的工作主要围绕最新微软技术动向进行，包括选题策划、社区活动、高端访谈、技术分析、培训讲座等。另外，作为微软（北京）.net俱乐部一员，积极参与线上线下活动，为社区做出贡献，这些工作都得到了微软的认可。所以即使是女孩子，只要能发挥自己的力量，给MS带来价值，一样能得到MS的认可，成为 MVP。说不定你也行啊！！！<br><br><b>主持人</b>：你被誉为中国最美丽的MVP，那么请问你是如何让枯燥的技术与美丽前沿的时尚完美结合的？<br><b>胡铭娅</b>：是这样吗？实在是让我受宠若惊了。这个称呼对我来说是莫大的荣幸，真是要谢谢大家了。其实，我觉得IT行业和时尚行业有一个共性，那就是更新速度快。“爱美之心人皆有之”，当你对自己有了充分的自信，相信你做起别的工作也会更加地得心应手。其实这源于你对生活的理解。<br><br><b>主持人</b>：是啊，信心确实是成功的源泉。不过，我们却不得不面对这样一个事实，就是在软件行业内，女性从业者仍然属于凤毛麟角，更遑论取得成功者。那么你作为这个行业的出类拔萃者，可有什么经验与体会与我们共同分享？<br><b>胡铭娅</b>：“出类拔萃”我不敢当，只不过是有一些见解而已。在软件行业，更新速度快，工作压力大，行业竞争激烈，软件从业者确实面临诸多困难。对于这些困难，我觉得关键要保持对技术的热情。只有找到自己的兴奋点，那么无论做什么，都不会觉得累。<br><br><b>主持人</b>：在软件行业，同样离不开媒体的推波助澜，尤其是出版社和技术网站，为技术的普及与推广做出了重要的贡献。你曾经就职于出版社，现在又是技术网站的资深编辑，请问你是怎么看待技术编辑与技术开发之间的关系呢？<br><b>胡铭娅</b>：他们之间有一个共性，就是都要求有一定的专业技术背景和实践能力。但两者之间是不同的。技术编辑还要具备媒体敏感性，良好的分析能力，能深刻理解技术含义，编程并不是他的优势和特长。虽然他有自己擅长的某一种技术，但他对相关的各项技术都有了解，他能以宏观的角度来看待技术发展，对技术的发展具有前瞻性。而开发人员其实更多的是专注于某一种技术，在某一种技术上有很深的造诣。工作职责不同，在不同的岗位上，做出的贡献是不一样的。<br><br><b>主持人</b>：面对你这样一位时尚美女，总是谈技术未免太枯燥了些。可否轻松一些，给我们谈谈你的业余生活？<br><b>胡铭娅</b>：工作之余，我喜欢去郊外走走，放松一下紧张的神经。有时候也会和好友们一起去K歌、尝试“开发”各种美食等:)。有时候我也喜欢安静地听音乐或看书、看杂志。<br><br><b>主持人</b>：最后一个问题，但绝对是最重要的一个问题，相信大多数网友也是最迫切希望知道答案的问题，那就是你心目中的白马王子会是怎样的？<br><b>胡铭娅</b>：呵呵:) 我想，我心中的白马王子应该是有责任感、有爱心，支持我、可以信任，而且可以互相帮助的人吧。<br><br><b>主持人</b>：非常感谢胡铭娅小姐能够在百忙之中接受我的采访。希望你在微软技术频道做出更多精彩的技术专题，谢谢！<br><b>胡铭娅</b>：谢谢！<br><br>博客园专访：<a href="http://news.cnblogs.com/interview/humingya/">http://news.cnblogs.com/interview/humingya/</a><br><img src ="http://www.cnblogs.com/wayfarer/aggbug/1242395.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41939/" target="_blank">[新闻]搜狗五笔输入法发布</a>]]></description></item><item><title>硝烟中的Scrum和XP</title><link>http://www.cnblogs.com/wayfarer/archive/2008/07/09/1239042.html</link><dc:creator>张逸</dc:creator><author>张逸</author><pubDate>Wed, 09 Jul 2008 08:31:00 GMT</pubDate><guid>http://www.cnblogs.com/wayfarer/archive/2008/07/09/1239042.html</guid><wfw:comment>http://www.cnblogs.com/wayfarer/comments/1239042.html</wfw:comment><comments>http://www.cnblogs.com/wayfarer/archive/2008/07/09/1239042.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnblogs.com/wayfarer/comments/commentRss/1239042.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/wayfarer/services/trackbacks/1239042.html</trackback:ping><description><![CDATA[<img src="http://www.infoq.com/resource/minibooks/scrum-xp-from-the-trenches/zh/cover/scrum-and-xp-cover.jpg" alt="" align="left">书名很酷炫，内容更精彩。最近InfoQ中国的编辑李剑（小刀）呕心沥血的译作《硝烟中的Scrum和XP》隆重推出，读者响应甚众。在第三届敏捷大会上，小刀“坐台”签名，免费派送本书之实体书，引发一轮抢书高潮。本着推广敏捷的宗旨，InfoQ又特别免费推出本书的电子版，以飨读者。小刀的翻译，可谓行云流水，绝妙好辞如行山阴道，应接不暇。读者读的是洋思想，享受的却是纯正的中国风。最重要的是在本书中，敏捷不再是思想的玄谈，而是方法的实践；不再是理论的空幻，而是实际的运用。废话不说，且看InfoQ对本书的介绍：<br> 
   		    
   	<p>
	
		在本书中，作者<a href="http://blog.crisp.se/henrikkniberg/">Henrik Kniberg</a>讲
述了他在一年的时间里，带领40人的团队实施Scrum的过程。他们试过了多种团队尺寸（3～12人）、sprint长度（2～6星期），定义“完成”的
不同方式，不同的backlog格式，各种测试策略，在多个Scrum团队之间进行同步的多种方式。他们还尝试过XP实践——持续集成、结对编程、测试驱
动开发等等，还试过了把XP跟Scrum组合。</p>
<p>本书描述的是一个成功敏捷团队的工作过程，没有理论、没有引用、没有脚注、没有废话。读者可以把它当作一些基础实践的入门指南，帮助团队进行正确实施——但不能模仿，你需要了解自己所处的环境，进而对具体实践做出取舍，创造出属于自己的过程。</p>
<p><strong>免费下载此书：</strong>硝烟中的Scrum和XP（
	
		<a href="http://www.infoq.com/resource/minibooks/scrum-xp-from-the-trenches/zh/pdf/scrum-and-xp-chinese-version.pdf">免费下载这本书（PDF）</a>
	
	
   	）</p>
<p>欢迎免费下载InfoQ中文站发布的其他迷你书，同时欢迎您向更多朋友推广，在您的博客和相关论坛中发布这些迷你书的摘要和链接，以让大家了解这些书的内容，访问InfoQ中文站下载阅读。</p>
<p><strong>.NET相关：</strong><a href="http://www.infoq.com/cn/minibooks/vsnettt">Visual Studio .NET使用技巧手册</a></p>
<p><strong>架构相关：</strong><a href="http://www.infoq.com/cn/minibooks/domain-driven-design-quickly">领域驱动设计精简版</a></p>
<p><strong>Java相关：</strong><a href="http://www.infoq.com/cn/minibooks/grails">Grails入门指南</a>、<a href="http://www.infoq.com/cn/minibooks/starting-struts2" title="深入浅出Struts2">深入浅出Struts2</a></p>
<p><strong>敏捷相关：</strong><a href="http://www.infoq.com/cn/minibooks/scrum-checklists">Scrum Checklists中文版</a></p><img src ="http://www.cnblogs.com/wayfarer/aggbug/1239042.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41938/" target="_blank">[新闻]新学年开始 大学生适用的十大互联网应用</a>]]></description></item><item><title>Scrum Practice in Project Management</title><link>http://www.cnblogs.com/wayfarer/archive/2008/07/01/1233054.html</link><dc:creator>张逸</dc:creator><author>张逸</author><pubDate>Tue, 01 Jul 2008 03:58:00 GMT</pubDate><guid>http://www.cnblogs.com/wayfarer/archive/2008/07/01/1233054.html</guid><wfw:comment>http://www.cnblogs.com/wayfarer/comments/1233054.html</wfw:comment><comments>http://www.cnblogs.com/wayfarer/archive/2008/07/01/1233054.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnblogs.com/wayfarer/comments/commentRss/1233054.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/wayfarer/services/trackbacks/1233054.html</trackback:ping><description><![CDATA[<p>ps: 这是我和同事曾理在hp写的命题作文，E文不好，请见谅。</p><strong>Abstract</strong><br><p>
<br>
Scrum is an iterative incremental process of Software development
commonly used with Agile Software Development. Especially, Scrum will
help us to manage the project more efficiently because it is an
adaptive process. However, applying the Scrum Methodology should depend
on the different situation during the process of project development.
It’s a big issue to solve. This article gives an example to elaborate
how to manage the project with Scrum.<br>
<br>
<strong>Introduction</strong>
</p>
<p>
Software development is a complex endeavor. So the most difficult
problem is how to handle the complexity through by the science of
project management. Many scientists and software engineers raised a
great number of methodologies for project management such as Waterfall,
UP and Agile. In contrast to the heavy methodologies including
Waterfall and UP, Agile is enough flexible to embrace the change, more
light to be mastered by project team members, and more focuses on the
communication and release of the usable software rapidly. Agile
methodologies include eXtreme Programming, Scrum, Feature Driven
Development and Crystal etc.<br>
<br>
Scrum was raised by Hirotaka Takeuchi and Ikujiro Nonaka in 1986. The skeleton is shown in Figure 1.
</p>
<p>
&nbsp;
</p>
<div style="text-align: center;">
<img src="http://www.agiledon.com/image.axd?picture=scrum.jpg" alt="">
</div>

<div align="center">
Figure 1<br>
</div>
<p>
The lower circle represents an iteration of development activities that
occur one after another. In Scrum, it was called Sprint. Each Sprint is
an iteration of 30 consecutive calendar days. The output of each sprint
is an increment of product. The upper circle represents the daily
inspection that occurs during the sprint, in which the individual team
members meet to inspect each others’ activities and make appropriate
adaptations.<br>
<br>
There are three roles in Scrum including ScrumMaster, Product Owner and
Team. The ScrumMaster is responsible for the Scrum process, for
teaching Scrum to everyone involved in the project, for implementing
Scrum and ensuring that everyone follows Scrum rules and practices. The
Product Owner is responsible for representing the interest of
stakeholders and creating the project’s initial overall requirement
which was called the Product Backlog, for using the Product Backlog to
ensure that the most valuable functionality is produces first and built
upon. The team is responsible for developing functionality. Teams are
self-managing, self-organizing, and cross-functional, and they are
responsible for figuring out how to return Product Backlog into an
increment of functionality within an iteration and managing their own
work to do so.<br>
<br>
<strong>Problem Statement</strong><br>
<br>
Without doubt, Scrum is one of most popular agile methodologies now.
It, however, is not easy to apply it to project management. Considering
about the following situations please:<br>
1. If the culture of your organization is contradictious with Scrum,
and your leader always interrupts you during the process of project
development, what should you do?<br>
2. If your team members are not familiar with Scrum, and they don’t understand the heart and rules of Scrum, what should you do?<br>
3. Furthermore if your team members didn’t master the basic skills of
Agile developing such as pair programming, Test Driven Development etc,
what should you do?<br>
4. If your customers always change their requirement, they are not clear what they want even, what should you do?<br>
<br>
<strong>Our Solution</strong><br>
<br>
In fact, we can’t find out the “Silver Bullet” to solve these problems.
We know Scrum is an adaptive process. Scrum makes many rules which
should be followed, but not hidebound. It’s agile and flexible. It
allows us to adjust the way to achieve the goal of project.<br>
<br>
The answer to the first question is operating within the culture of the
organization. Don’t fight against the culture of your company. If you
are ScrumMaster, you’d better walk a fine line between the
organization’s need to make changes as quickly as possible and its
limited tolerance for change. You can adopt Scrum by starting small. At
the same time, you should try your best to persuade your leader to
support you. Sometimes your leader will build the bridge between the
agile world and non-agile for you. Of course, it needs change, but
these changes must be culturally acceptable. If not, you must
acquiesce. The ScrumMaster is a sheepdog of the team, and his job is to
protect the team from impediments during the Sprint. Remember that the
precondition of which everything is going on well is that the sheepdog
cannot be dead. After all, Scrum is the art of the possible.<br>
<br>
Right, we hope our team members are all software craftsman so that
everything is Ok. Unfortunately, the real world is not as good as that
we expect. In fact, the situation in which most of team members are all
apprentices is more common. It is true that it is difficult to hire the
experienced software engineer in this industry. So the problem we must
solve is how to train them. We should draw up a training plan. Before
it, we must understand the skill set of everybody. We need to assign
the mentors to the fresh guys. Of course, the best way of training is
practice. We should assign the task to them according to their ability.
At the same time, we have to add the task duration because they are not
familiar with the related skills. Besides, Pair programming is a good
way to handle it.<br>
<br>
The great character of Scrum is enough flexible to embrace the change.
Scrum is an iterative and incremental process. The iteration is very
short (30 days) so that we can change our plan in time. The incremental
development will provide the good policy to submit the release rapidly.
The increment product can give our customers confidence. And the
customers can understand the difference between what they want and what
we provide though by the running software. Scrum emphasis on the
communication between the team and customers. Product Owner of Scrum is
responsible for communicating with the customers and creating the
product backlog. In case the customers changed their requirements, the
Product Owner will discuss with ScrumMaster and Team. If the change is
acceptable, it is added into the product backlog. If the change is
within the sprint which the team is developing, the sprint has to halt,
and re-open the new sprint. Beside, the daily scrum will help each team
member understand the current statue of the project, and the sprint
review meeting will show the result of the sprint to the customers in
order to get the feedback from the customers, the sprint retrospection
meeting will prompt the Scrum process framework and practices.<br>
<br>
<strong>Evidence that the Solution Works</strong><br>
<br>
Now we complete the first sprint of the project on time. In a month, we
went through the whole lifecycle of the software development from the
requirement analysis to designing, coding and testing. Each member is
familiar with the Scrum gradually. Everything is going on well such as
Daily Scrum, Team Work and Sprint Development. In the end of this
sprint, we submit the increment product to our customers and get the
feedback from the customers. The most important achievement is that our
customers approve our approach to develop the product.<br>
<br>
<strong>Competitive Approaches</strong><br>
<br>
We don’t follow the rule of Agile Methodology strictly. For instance,
most of team members are accustomed to the TDD (Test Driven
Development), so we adopt the traditional way to design and develop the
software such as Use Case Driven Development instead of TDD. But we
require everybody must write the test case for classes and components.
We organize the pair programming group to prompt each other.<br>
<br>
Because our customers are off-site, so we require our Product Owner
must be in-site and cooperate with them in full time. We create the
communication schedule for the customers to understand the customers’
requirement. The Product Owner is empowered to handle everything with
requirement.<br>
<br>
Especially, the ScrumMaster of our project protects the team from the
rest of the non-agile world. We get the enough resources and backup.
For example, we have our own agile coach to direct how to apply the
Scrum to our project. He can help us to solve the key problem when we
are confused of Scrum Methodology.<br>
<br>
<strong>Current Status</strong><br>
<br>
The project is going on well. The first sprint is very successful. Team
members are all confidence. They regard the Scrum as the effective and
enjoyable process. The customers are satisfied with our process. Most
of risks had already solved because we emphasis on them and add them as
the tasks into the sprint backlog.<br>
<br>
<strong>Next Steps</strong><br>
<br>
Next month, we are going to hold the Sprint retrospective meeting to
find out the existed problems in the first sprint. Then we will create
the backlog for next sprint. In this sprint, we will develop the most
important domain module and let it workable.<br>
<br>
<strong>Conclusions</strong><br>
<br>
Scrum is an excellent agile methodology to release the software product
rapidly and correctly. It gives all team members the new management
responsibilities. The process of the project management is visible and
controllable. The ScrumMaster and Product Owner don’t need to write the
redundant documents and draw up the unrealistic project plan. The team
members become more active due to self-organizing and self-managing.<br>
<br>
<strong>References</strong><br>
1. Agile Project Management with Scrum, Ken Schwaber<br>
2. Software Craftsmanship, Pete McBreen<br>
3. Applying UML And Patterns, Craig Larman</p><p>Co-author: Zeng Li, Zhang Yi<br>
</p><img src ="http://www.cnblogs.com/wayfarer/aggbug/1233054.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41937/" target="_blank">[新闻]Google拟在9月发布自有浏览器 或采用火狐内核</a>]]></description></item><item><title>在敏捷开发中采用演进式架构设计</title><link>http://www.cnblogs.com/wayfarer/archive/2008/05/11/1192606.html</link><dc:creator>张逸</dc:creator><author>张逸</author><pubDate>Sun, 11 May 2008 13:00:00 GMT</pubDate><guid>http://www.cnblogs.com/wayfarer/archive/2008/05/11/1192606.html</guid><wfw:comment>http://www.cnblogs.com/wayfarer/comments/1192606.html</wfw:comment><comments>http://www.cnblogs.com/wayfarer/archive/2008/05/11/1192606.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnblogs.com/wayfarer/comments/commentRss/1192606.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/wayfarer/services/trackbacks/1192606.html</trackback:ping><description><![CDATA[<img src="http://www.agiledon.com/image.axd?picture=april-08-architecturewide.jpg" alt="" align="left">&nbsp;&nbsp;&nbsp;
在敏捷开发过程中，我们还需要对系统架构进行设计吗？事实上，Martin Fowler在《Is Design
Dead?》一文中已经给出了答案，那就是我们同样不能忽略对系统架构的设计。与计划性的设计（Planned
Design）不同，我们需要演进式的设计（Evolutionary
Design）。在敏捷开发的生命周期中，我们通过每一次迭代来丰富与更新我们的设计方案，以使其最大限度地符合客户对系统的需求。这里所指的需求，包括
功能性需求和非功能性需求。<br>
<br>
&nbsp;&nbsp;&nbsp; 在Agile Journal四月刊中，IBM's Methods Group的敏捷专家Scott W.
Ambler详细地阐述了在敏捷语境中的架构设计方法，他提出了所谓“架构预测（Architectural
Envisioning）”的方法，以应对敏捷开发中逐步演进的架构设计过程。<br>
<br>
&nbsp;&nbsp;&nbsp; Scott指出，敏捷模型驱动开发（Agile Model Driven
Development，AMDD）明确地包括了初始需求分析与架构建模，这个过程发生在敏捷项目开发的第0次迭代中。所谓第0次迭代，就相当于项目的热
身活动，是项目得以启动的基础。在此迭代期间，团队需要充分地理解项目的范围，甄别可行地技术策略。这个阶段所能够收集到的信息将有助于你对整个项目最初
的粗略估计，以制定合适的项目计划，从而获得启动项目的资金与足够的支持。<br><br>更多内容，请阅读发表在捷道·敏捷堂的<a href="http://www.agiledon.com/post/2008/05/Evolutionary-Design-in-Agile.aspx">文章</a>。<br><img src ="http://www.cnblogs.com/wayfarer/aggbug/1192606.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41936/" target="_blank">[新闻]微软正在构思将Wi-Fi带入汽车</a>]]></description></item></channel></rss>