<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://ioriwellings.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fioriwellings.spaces.live.com%2fcategory%2fLINQ%2bto%2bWhat%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>不及格的程序员-八神: LINQ to What</title><description /><link>http://ioriwellings.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catLINQ%2bto%2bWhat</link><language>en-US</language><pubDate>Thu, 14 Aug 2008 06:40:01 GMT</pubDate><lastBuildDate>Thu, 14 Aug 2008 06:40:01 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://ioriwellings.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>-3107968651015171382</live:id><live:alias>ioriwellings</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>LINQ  查询的同一条记录</title><link>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1203.entry</link><description>&lt;div&gt;星期四 天气:多云&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; 延迟加载中,多次查询同一条记录,会返回同一个对象. 但如果设置ObjectTrackingEnabled = false,则是不同的.&lt;/div&gt;
&lt;div&gt; Attach,可以管理被反序列化的对象,将其从新投入DataContent的怀抱.&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-3107968651015171382&amp;page=RSS%3a+LINQ++%e6%9f%a5%e8%af%a2%e7%9a%84%e5%90%8c%e4%b8%80%e6%9d%a1%e8%ae%b0%e5%bd%95&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=ioriwellings.spaces.live.com&amp;amp;GT1=ioriwellings"&gt;</description><comments>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1203.entry#comment</comments><guid isPermaLink="true">http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1203.entry</guid><pubDate>Thu, 29 May 2008 14:21:40 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://ioriwellings.spaces.live.com/blog/cns!D4DE46FA8730D2CA!1203/comments/feed.rss</wfw:commentRss><wfw:comment>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1203.entry#comment</wfw:comment><dcterms:modified>2008-05-29T14:21:40Z</dcterms:modified></item><item><title>刚刚VS2008 完成了一个工具软件,里面充满了LINQ,贴几个有特点的以示留念!</title><link>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1187.entry</link><description>&lt;div&gt;星期三 天气:晴&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;LINQ to Sting:&lt;/div&gt;
&lt;div&gt;var s = &amp;quot;Server=172.17.1.1;uid=test;pwd=123;database=test&amp;quot;.split(';')&lt;/div&gt;
&lt;div&gt;获取服务器地址:(from valuer in s&lt;/div&gt;
&lt;div&gt;where value.ToLower().Contains(&amp;quot;server&amp;quot;)&lt;br&gt;select value.Split('=')).First().ElementAt(1)&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;LINQ TO XML&lt;/div&gt;
&lt;div&gt;&lt;pre style="overflow:auto;width:600px;height:200px"&gt;private void WriterBlock(DataTable dttBlock)
        {
            XElement xmlBlock = new XElement(
                &amp;quot;Blocks&amp;quot;,
                from DataRow row in dttBlock.AsEnumerable()
                select new XElement(
                    &amp;quot;Block&amp;quot;,
                    new XElement(&amp;quot;ModuleID&amp;quot;, row.Field(&amp;quot;cModuleID&amp;quot;)),
                    new XElement(&amp;quot;UnitID&amp;quot;, row.Field(&amp;quot;cUnitID&amp;quot;)),
                    new XElement(&amp;quot;BlockWidth&amp;quot;, row.Field(&amp;quot;iBlockWidth&amp;quot;)),
                    new XElement(&amp;quot;BlockHeight&amp;quot;, row.Field(&amp;quot;iBlockHeight&amp;quot;)),
                    new XElement(&amp;quot;BlockPath&amp;quot;, row.Field(&amp;quot;cBlockPath&amp;quot;))
                    )
                );
            var searchModuleID = (from module in dttBlock.AsEnumerable()
                                  select module.Field(&amp;quot;cModuleID&amp;quot;)).Distinct();
            foreach (var moduleID in searchModuleID)
            {
                List eleBlock = (from XElement ele in xmlBlock.Elements(&amp;quot;Block&amp;quot;)
                                          where ele.Element(&amp;quot;ModuleID&amp;quot;).Value == moduleID
                                          select ele).ToList();
                System.IO.FileStream file = System.IO.File.Create(&amp;quot;C:\\TestDownload\\RIT-&amp;quot; + moduleID + &amp;quot;-03.SQL&amp;quot;, 512);
                using (var temp = new System.IO.StreamWriter(file))
                {
                    foreach (XElement ele in eleBlock)
                    {
                        temp.WriteLine(@&amp;quot;INSERT INTO tFrrBlockUnit (cUnitID, iBlockWidth, iBlockHeight, cBlockPath) VALUES ('{0}', '{1}', '{2}', '{3}')&amp;quot;,
                            ele.Element(&amp;quot;UnitID&amp;quot;).Value,
                            ele.Element(&amp;quot;BlockWidth&amp;quot;).Value,
                            ele.Element(&amp;quot;BlockHeight&amp;quot;).Value,
                            ele.Element(&amp;quot;BlockPath&amp;quot;).Value
                            );
                    }
                }
            }
        }&lt;/pre&gt;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-3107968651015171382&amp;page=RSS%3a+%e5%88%9a%e5%88%9aVS2008+%e5%ae%8c%e6%88%90%e4%ba%86%e4%b8%80%e4%b8%aa%e5%b7%a5%e5%85%b7%e8%bd%af%e4%bb%b6%2c%e9%87%8c%e9%9d%a2%e5%85%85%e6%bb%a1%e4%ba%86LINQ%2c%e8%b4%b4%e5%87%a0%e4%b8%aa%e6%9c%89%e7%89%b9%e7%82%b9%e7%9a%84%e4%bb%a5%e7%a4%ba%e7%95%99%e5%bf%b5!&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=ioriwellings.spaces.live.com&amp;amp;GT1=ioriwellings"&gt;</description><comments>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1187.entry#comment</comments><guid isPermaLink="true">http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1187.entry</guid><pubDate>Wed, 07 May 2008 08:58:53 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://ioriwellings.spaces.live.com/blog/cns!D4DE46FA8730D2CA!1187/comments/feed.rss</wfw:commentRss><wfw:comment>http://ioriwellings.spaces.live.com/Blog/cns!D4DE46FA8730D2CA!1187.entry#comment</wfw:comment><dcterms:modified>2008-05-07T08:58:53Z</dcterms:modified></item></channel></rss>