<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Performance on ZeroSharp</title><link>https://www.zerosharp.com/blog/categories/performance/</link><description>Recent content in Performance on ZeroSharp</description><generator>Hugo</generator><language>en-gb</language><copyright>Copyright © 2012–{year} Robert Anderson</copyright><lastBuildDate>Tue, 27 Aug 2013 09:14:00 +0100</lastBuildDate><atom:link href="https://www.zerosharp.com/blog/categories/performance/index.xml" rel="self" type="application/rss+xml"/><item><title>MiniProfiler with DevExpress XAF</title><link>https://www.zerosharp.com/miniprofiler-with-devexpress-xaf/</link><pubDate>Tue, 27 Aug 2013 09:14:00 +0100</pubDate><guid>https://www.zerosharp.com/miniprofiler-with-devexpress-xaf/</guid><description>&lt;p&gt;In this post I will demonstrate how to add &lt;a href="http://miniprofiler.com/"&gt;MiniProfiler&lt;/a&gt; to the XAF MainDemo web application.&lt;/p&gt;
&lt;p&gt;MiniProfiler is a simple fast profiler with a pretty user interface. It is fast because it only profiles code that you have explicitly decorated with the &lt;code&gt;MiniProfiler.Step()&lt;/code&gt; method. It was designed by the team at &lt;a href="http://stackoverflow.com/"&gt;StackOverflow&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, add the MiniProfiler NuGet package to the MainDemo.Web project. Then add a placeholder to &lt;em&gt;default.aspx&lt;/em&gt; just before the last &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;</description></item><item><title>A look at the DevExpress MainDemo with Google Page Speed</title><link>https://www.zerosharp.com/a-look-at-the-devexpress-maindemo-with-google-page-speed/</link><pubDate>Wed, 12 Sep 2012 17:22:00 +0100</pubDate><guid>https://www.zerosharp.com/a-look-at-the-devexpress-maindemo-with-google-page-speed/</guid><description>&lt;p&gt;In this post I&amp;rsquo;ll demonstrate how to use the &lt;a href="https://developers.google.com/speed/pagespeed/"&gt;Google Page Speed&lt;/a&gt; tools to analyse the performance of the DevExpress XAF MainDemo.&lt;/p&gt;
&lt;p&gt;The easiest way to run Google Page Speed is as a Chrome or Firefox plugin. Both are available &lt;a href="https://developers.google.com/speed/pagespeed/insights_extensions"&gt;here&lt;/a&gt;. I use Chrome.&lt;/p&gt;
&lt;p&gt;Now open the DevExpress MainDemo from Visual Studio. By default it is installed to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;C:\Users\Public\Documents\DXperience 12.1 Demos\eXpressApp Framework\MainDemo\CS\MainDemo.sln
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Set the MainDemo.Web as the startup project and change the connection string in web.config if necessary. Launch the application with Chrome and login as &amp;lsquo;Sam&amp;rsquo; (password is blank). Then press &lt;code&gt;F12&lt;/code&gt; to bring up the developer tools. The last tab is the Page Speed Analysis and your browser should look like this:&lt;/p&gt;</description></item><item><title>XpoBatch source code available</title><link>https://www.zerosharp.com/xpobatch-source-code-available/</link><pubDate>Wed, 25 Jul 2012 16:24:00 +0100</pubDate><guid>https://www.zerosharp.com/xpobatch-source-code-available/</guid><description>&lt;p&gt;The source code for the fast batch operations with DevExpress XPO &lt;a href="https://github.com/ZeroSharp/XpoBatch"&gt;is now available on on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It includes unit tests that can be run against SQL Server or in memory. It runs against DevExpress 12.1.7, but it will work against 11.2 (and possibly earlier versions) with a couple of minor modifications which are documented in the code.&lt;/p&gt;
&lt;h4 id="references"&gt;References&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.zerosharp.com/fast-batch-deletions-with-devexpress-xpo/"&gt;Fast batch deletions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zerosharp.com/fast-batch-modifications-with-devexpress-xpo/"&gt;Fast batch modifications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Fast batch modifications with DevExpress XPO</title><link>https://www.zerosharp.com/fast-batch-modifications-with-devexpress-xpo/</link><pubDate>Tue, 24 Jul 2012 14:02:00 +0100</pubDate><guid>https://www.zerosharp.com/fast-batch-modifications-with-devexpress-xpo/</guid><description>&lt;p&gt;Last week I wrote about &lt;a href="https://www.zerosharp.com/fast-batch-deletions-with-devexpress-xpo/"&gt;fast batch deletions&lt;/a&gt;. In this post I&amp;rsquo;ll show how to do the same for modifications.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s assume we want to replace the &amp;lsquo;State&amp;rsquo; property with &amp;lsquo;CA&amp;rsquo; and CostCenter with 123 for all records where the &amp;lsquo;City&amp;rsquo; is &amp;lsquo;San Francisco&amp;rsquo;. The recommended DevExpress approach would be something like the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1
&lt;/span&gt;&lt;span class="lnt"&gt; 2
&lt;/span&gt;&lt;span class="lnt"&gt; 3
&lt;/span&gt;&lt;span class="lnt"&gt; 4
&lt;/span&gt;&lt;span class="lnt"&gt; 5
&lt;/span&gt;&lt;span class="lnt"&gt; 6
&lt;/span&gt;&lt;span class="lnt"&gt; 7
&lt;/span&gt;&lt;span class="lnt"&gt; 8
&lt;/span&gt;&lt;span class="lnt"&gt; 9
&lt;/span&gt;&lt;span class="lnt"&gt;10
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;UnitOfWork&lt;/span&gt; &lt;span class="n"&gt;uow&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;UnitOfWork&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;	
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;	&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;xpCollection&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;XPCollection&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyObject&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;uow&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CriteriaOperator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;City == &amp;#39;San Francisco&amp;#39;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyObject&lt;/span&gt; &lt;span class="n"&gt;myObject&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;xpCollection&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;myObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;State&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;#34;CA&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;myObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CostCenter&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;uow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CommitChanges&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The problem with the above code is that every record must be loaded and then an individual &lt;code&gt;UPDATE&lt;/code&gt; command is generated for each modification. This is necessary for the business logic to be applied correctly (such as the code in methods such as &lt;code&gt;OnSaving()&lt;/code&gt;). It is also necessary to handle record locking.&lt;/p&gt;</description></item><item><title>Fast batch deletions with DevExpress XPO</title><link>https://www.zerosharp.com/fast-batch-deletions-with-devexpress-xpo/</link><pubDate>Thu, 12 Jul 2012 17:00:00 +0100</pubDate><guid>https://www.zerosharp.com/fast-batch-deletions-with-devexpress-xpo/</guid><description>&lt;p&gt;When deleting a collection of objects, DevExpress recommends using &lt;a href="http://documentation.devexpress.com/#XPO/DevExpressXpoSession_Deletetopic116"&gt;&lt;code&gt;Session.Delete(ICollection objects)&lt;/code&gt;&lt;/a&gt;. This has the same effect as calling the &lt;code&gt;Delete()&lt;/code&gt; method for every object in the collection so that the business logic is applied correctly. The business logic in this context refers to code such as that in the &lt;code&gt;OnDeleting()&lt;/code&gt;, &lt;code&gt;OnDeleted()&lt;/code&gt; methods, but it also includes the clearing of references to the object by other objects. This approach is slow, but ensures the integrity of the data.&lt;/p&gt;</description></item></channel></rss>