﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>https://ayende.com/blog/</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>NHibernate Profiler and Entity Framework Profiler 5.0 RTM</title><description>&lt;p&gt;&lt;a href="http://hibernatingrhinos.com/products/efprof"&gt;&lt;img width="393" height="356" title="image" align="right" style="border: 0px currentcolor; border-image: none; float: right; display: inline; background-image: none;" alt="image" src="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Profiler-and-Entity-Fra.0-RTM_DBDD/image_3.png" border="0"&gt;&lt;/a&gt;I’m really happy to announce that we have just release a brand new version of NHibernate Profiler and Entity Framework Profiler.&lt;/p&gt;&lt;p&gt;What is new in for &lt;a href="http://hibernatingrhinos.com/products/nhprof"&gt;NHibernate&lt;/a&gt;?&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Support for NHibernate 5.1 and 5.1.1&lt;/li&gt;&lt;li&gt;Support for .NET Core&lt;/li&gt;&lt;ul&gt;&lt;li&gt;supported on the following platforms: netstandard2.0, net46, netcoreapp2.0&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Fixed various minor issues regarding showing duplicate errors and warnings from NHibernate.&lt;/li&gt;&lt;li&gt;Better support for DateTime precision issues in NHibernate 5.0&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;What is new for &lt;a href="http://hibernatingrhinos.com/products/efprof"&gt;Entity Framework&lt;/a&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Support for EF Core&lt;/li&gt;&lt;ul&gt;&lt;li&gt;supported on the following platforms: netstandard2.0, net46, netcoreapp2.0&lt;/li&gt;&lt;li&gt;netstandard1.6 is also supported via a separate dll. &lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Support for DataTable data type in custom reporting&lt;/li&gt;&lt;li&gt;Support for ReadCount and RecordsAFfected in EF Core 2.0&lt;/li&gt;&lt;li&gt;Fixed issue for EF 6 on .NET 4.7&lt;/li&gt;&lt;li&gt;Can report using thread name, not just application name&lt;/li&gt;&lt;li&gt;Provide integration hooks for ASP.Net Core to provide contextual information for queries.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;New stuff for both of them:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Improved column type mismatch warning &lt;/li&gt;&lt;li&gt;Support for UniqueIdentifier parameters type&lt;/li&gt;&lt;li&gt;Support for integration with VS 2017.&lt;/li&gt;&lt;/ul&gt;</description><link>https://ayende.com/blog/182657-A/nhibernate-profiler-and-entity-framework-profiler-5-0-rtm?Key=790101c4-869e-4198-8ebf-da3efdc21666</link><guid>https://ayende.com/blog/182657-A/nhibernate-profiler-and-entity-framework-profiler-5-0-rtm?Key=790101c4-869e-4198-8ebf-da3efdc21666</guid><pubDate>Tue, 17 Apr 2018 09:00:00 GMT</pubDate></item><item><title>NHibernate Profiler 5.0 Alpha has been released</title><description>&lt;p&gt;&lt;a href="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Pro.0-Alpha-has-been-released_13653/image_2.png"&gt;&lt;img style="float: right; display: inline; background-image: none;" title="image" src="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Pro.0-Alpha-has-been-released_13653/image_thumb.png" alt="image" width="438" height="276" align="right" border="0" /&gt;&lt;/a&gt;The &lt;a href="http://hibernatingrhinos.com/products/nhprof"&gt;next generation of our profiler&lt;/a&gt; is starting to shift into higher gear, with today&amp;rsquo;s release of &lt;a href="http://hibernatingrhinos.com/products/nhprof"&gt;the NHibernate Profiler 5.0 Alpha.&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The new bits &lt;a href="https://www.nuget.org/packages/NHibernateProfiler/5.0.5002-alpha"&gt;are available directly from NuGet&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The new release brings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Support for NHibernate 5.0.0 and NHibernate 5.0.1&lt;/li&gt;
&lt;li&gt;The profiler appender now require .NET Standard 2.0 (older appenders, supporting older runtimes will still work with the new release).&lt;/li&gt;
&lt;li&gt;Fixes for various bugs, aches and pains.&lt;/li&gt;
&lt;li&gt;Faster serialization format over the wire.&lt;/li&gt;
&lt;li&gt;Reduce the cost of profiling your application significantly by reducing contention.&lt;/li&gt;
&lt;li&gt;Better stack trace and profiling support for .NET standard 2.0 apps.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is just the beginning, getting the major stuff that &lt;em&gt;need&lt;/em&gt; to be there for the next release before we get down and start implementing the cool features. But these changes (and especially the support for NHibernate 5.x)&amp;nbsp; are major enough that we would like to have users test them out in the field.&lt;/p&gt;
&lt;p&gt;Licensing wise, for the alpha period any 4.x license for the profiler will work on the 5.0 alpha.&lt;/p&gt;
&lt;p&gt;You can download it &lt;a href="http://hibernatingrhinos.com/builds?product=uberprof&amp;amp;version=5.0&amp;amp;channel=unstable"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>https://ayende.com/blog/180836/nhibernate-profiler-5-0-alpha-has-been-released?Key=c11369be-d18b-4522-934d-e1321f0024dd</link><guid>https://ayende.com/blog/180836/nhibernate-profiler-5-0-alpha-has-been-released?Key=c11369be-d18b-4522-934d-e1321f0024dd</guid><pubDate>Fri, 24 Nov 2017 10:00:00 GMT</pubDate></item><item><title>NHibernate Profiler &amp; Entity Framework Profiler 4.0–Beta Release</title><description>&lt;p&gt;&lt;a href="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Profiler--Entit.0Beta-Release_AD04/image_19.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: right; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Profiler--Entit.0Beta-Release_AD04/image_thumb_7.png" width="554" align="right" height="394"&gt;&lt;/a&gt;I’m happy to announce that the next version of the NHibernate and Entity Framework Profilers is ready for beta testing&lt;/p&gt; &lt;p&gt;You can download the new bits &lt;a href="https://hibernatingrhinos.com/builds/Uber-Prof-v4"&gt;from here&lt;/a&gt;.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Entity Framework – Support for EF Core (on .NET Core and .Net 4.6)  &lt;li&gt;NHibernate Profiler – Support for NHibernate 4.1 &lt;/li&gt; &lt;li&gt;Persisting interesting sessions across restarts.  &lt;li&gt;Improved filtering of SQL statements and behaviors, persisting your configuration across restarts and generally behaving as a responsible citizen.  &lt;li&gt;The ability to configure profiling via a &lt;a href="http://issues.hibernatingrhinos.com/issue/UberProf-347"&gt;watched file&lt;/a&gt;, to enable admins to enable/disable profiling on the fly.  &lt;li&gt;Allowing you to edit and run a SQL statement as well as compare the database query plan generated so you can get to an optimal solution.  &lt;li&gt;Various usability improvements (auto tracking of interesting data, always on top, compact mode for quick visualizations, better keyboard navigation, etc).&lt;/li&gt;&lt;/ul&gt;    &lt;p&gt;Please take them for a spin and provide us with feedback on it.&lt;/p&gt; &lt;p&gt;&lt;a href="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Profiler--Entit.0Beta-Release_AD04/image_22.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: right; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="https://ayende.com/blog/Images/Open-Live-Writer/NHibernate-Profiler--Entit.0Beta-Release_AD04/image_thumb_8.png" width="486" align="right" height="446"&gt;&lt;/a&gt;&lt;/p&gt;</description><link>https://ayende.com/blog/176897/nhibernate-profiler-entity-framework-profiler-4-0-beta-release?Key=6556f5ee-8edf-4db6-9de6-dd27d1d8befd</link><guid>https://ayende.com/blog/176897/nhibernate-profiler-entity-framework-profiler-4-0-beta-release?Key=6556f5ee-8edf-4db6-9de6-dd27d1d8befd</guid><pubDate>Thu, 26 Jan 2017 10:00:00 GMT</pubDate></item><item><title>Special Offer: 29% discount for all our products</title><description>&lt;p&gt;Well, it is nearly the 29 May, and that means that I have been married for four years. &lt;p&gt;To celebrate that, I am offering a &lt;strong&gt;29%&lt;/strong&gt; discount on all our products (&lt;a href="http://ravendb.net/buy"&gt;RavenDB&lt;/a&gt;, &lt;a href="http://www.hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt;, &lt;a href="http://www.hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;). &lt;p&gt;All you have to do is purchase any of our products using the following coupon code: &lt;blockquote&gt; &lt;p&gt;4th Anniversary&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This offer is valid to the end of the month only.&lt;/p&gt;</description><link>https://ayende.com/blog/170945/special-offer-29-discount-for-all-our-products?Key=7bc5d5a8-d6b7-43ae-924e-83d5524b8bb3</link><guid>https://ayende.com/blog/170945/special-offer-29-discount-for-all-our-products?Key=7bc5d5a8-d6b7-43ae-924e-83d5524b8bb3</guid><pubDate>Wed, 27 May 2015 08:16:00 GMT</pubDate></item><item><title>End of year discount, last 2 coupons remaining</title><description>&lt;p&gt;Reminding you that the end of year coupon has 2 remaining uses. &lt;p&gt;You can use: &lt;u&gt;0x21-celebrate-new-year&lt;/u&gt; to purchase any of the following with a 21% discount: &lt;ul&gt; &lt;li&gt;&lt;a href="http://ravendb.net/buy"&gt;RavenDB&lt;/a&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This is valid for today only, so hurry up.&lt;/p&gt;</description><link>https://ayende.com/blog/169697/end-of-year-discount-last-2-coupons-remaining?Key=12328495-62ad-450f-ac34-6f61749366ee</link><guid>https://ayende.com/blog/169697/end-of-year-discount-last-2-coupons-remaining?Key=12328495-62ad-450f-ac34-6f61749366ee</guid><pubDate>Wed, 31 Dec 2014 08:08:00 GMT</pubDate></item><item><title>End of year discount coupon has 7 remaining uses</title><description>&lt;p&gt;
	Reminding you that the end of year coupon has 7 remaining uses.&lt;/p&gt;
&lt;p&gt;
	You can use: &lt;u&gt;0x21-celebrate-new-year&lt;/u&gt; to purchase any of:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;a href="http://ravendb.net/buy"&gt;RavenDB&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	Happy Holidays and a great new years.&lt;/p&gt;
</description><link>https://ayende.com/blog/169633/end-of-year-discount-coupon-has-7-remaining-uses?Key=240c5620-aff1-4bb8-8134-ccb78938e3bd</link><guid>https://ayende.com/blog/169633/end-of-year-discount-coupon-has-7-remaining-uses?Key=240c5620-aff1-4bb8-8134-ccb78938e3bd</guid><pubDate>Tue, 23 Dec 2014 14:00:00 GMT</pubDate></item><item><title>End of year discount for all our products</title><description>&lt;p&gt;
	To celebrate the new year, we offer a &lt;strong&gt;21% discount &lt;/strong&gt;for all our products. This is available for the first &lt;strong&gt;33 customers &lt;/strong&gt;that use the coupon code: &lt;u&gt;0x21-celebrate-new-year&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;
	In previous years, we offered a similar number of uses for the coupon code, and they run out fast, so hurry up. This offer is valid for:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;
		&lt;a href="http://ravendb.net/buy"&gt;RavenDB&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;
		&lt;a href="http://hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
	Happy Holidays and a great new years.&lt;/p&gt;
&lt;p&gt;
	On a personal note, this marks the full release of all our product lines, and it took an incredible amount of work. I&amp;#39;m very pleased that we have been able to get the new version out there and in your hands, and to have you start making use of the features that we have been working on for so long.&lt;/p&gt;
</description><link>https://ayende.com/blog/169537/end-of-year-discount-for-all-our-products?Key=9d62ffc7-b15f-47ee-8110-de5e4ed34982</link><guid>https://ayende.com/blog/169537/end-of-year-discount-for-all-our-products?Key=9d62ffc7-b15f-47ee-8110-de5e4ed34982</guid><pubDate>Thu, 11 Dec 2014 10:00:00 GMT</pubDate></item><item><title>NHibernate &amp; Entity Framework Profiler 3.0</title><description>&lt;p&gt;
	It may not get enough attention, but we have been working on the profilers as well during the past few months.&lt;/p&gt;
&lt;blockquote&gt;
	&lt;p&gt;
		TLDR; You can get the next generation of &lt;a href="http://www.hibernatingrhinos.com/products/nhprof"&gt;NHibernate Profiler&lt;/a&gt; and &lt;a href="http://www.hibernatingrhinos.com/products/efprof"&gt;Entity Framework Profiler&lt;/a&gt; now, lots of goodies to look at!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	I&amp;rsquo;m sure that a lot of people would be thrilled to hear that we dropped Silverlight in favor of going back to WPF UI. The idea was that we would be able to deploy anywhere, including in production. But Silverlight just made things harder all around, and customers didn&amp;rsquo;t like the production profiling mode.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Production Profiling&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	We have changed how we profile in production. You can now make the following call in your code:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;pre class="csharpcode"&gt;
NHibernateProfiler.InitializeForProduction(port, password);&lt;/pre&gt;
	&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }	&lt;/style&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	And then connect to your production system:&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_2.png"&gt;&lt;img alt="image" border="0" height="470" src="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_thumb.png" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" title="image" width="416" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	At which point you can profile what is going on in your production system safely and easily. The traffic between your production server and the profiler is SSL encrypted.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;NHibernate 4.x and Entity Framework vNext support&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	The profilers now support the latest version of NHibernate and Entity Framework. That include profiling async operations, better suitability for modern apps, and more.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;New SQL Paging Syntax&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	We are now properly support SQL Server paging syntax:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;select&lt;/span&gt; * &lt;span class="kwrd"&gt;from&lt;/span&gt; Users
&lt;span class="kwrd"&gt;order&lt;/span&gt; &lt;span class="kwrd"&gt;by&lt;/span&gt; Name
offset 0 /* @p0 */ &lt;span class="kwrd"&gt;rows&lt;/span&gt; &lt;span class="kwrd"&gt;fetch&lt;/span&gt; &lt;span class="kwrd"&gt;next&lt;/span&gt; 250 /* @p1 */ &lt;span class="kwrd"&gt;rows&lt;/span&gt; &lt;span class="kwrd"&gt;only&lt;/span&gt;
&lt;/pre&gt;
	&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }	&lt;/style&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	This is great for NHibernate users, who finally can have a sane paging syntax as well as beautiful queries in the profiler.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;At a glance view&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	A lot of the time, you don&amp;rsquo;t want the profiler to be front and center, you want to just run it and have it there to glance at once in a while. The new compact view gives you just that:&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_4.png"&gt;&lt;img alt="image" border="0" height="232" src="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_thumb_1.png" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" title="image" width="628" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	You can park it at some point in your screen and work normally, glancing to see if it found anything. This is much less distracting than the full profiler for normal operations.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Scopes and groups&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	When we started working on the profilers, we followed the &amp;ldquo;one session per request&amp;rdquo; rule, and that was pretty good. But a lot of people, especially in the Entity Framework group are using multiple sessions or data contexts in a single request, but they still want to see the ability to see the operations in a request at a glance. We are now allowing you to group things, like this:&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_6.png"&gt;&lt;img alt="image" border="0" height="415" src="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_thumb_2.png" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" title="image" width="628" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	By default, we use the current request to group things, but we also give you the ability to define your own scopes. So if you are profiling NServiceBus application, you can set the scope as your message handling by setting ProfilerIntegration.GetCurrentScopeName or explicitly calling ProfilerIntegration.StartScope whenever you want.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Customized profiling&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	You can now surface troublesome issues directly from your code. If you have an issue with a query, you can mark it for attention using &lt;b&gt;CustomQueryReporting&lt;/b&gt; .ReportError() that would flag it in the UI for further investigation.&lt;/p&gt;
&lt;p&gt;
	You can also just mark interesting pieces in the UI without an error, like so:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;using&lt;/span&gt; (var db = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entities(conStr))
{
    var post1 = db.Posts.FirstOrDefault();

   &lt;strong&gt; &lt;span class="kwrd"&gt;using&lt;/span&gt; (ProfilerIntegration.StarStatements(&lt;span class="str"&gt;&amp;quot;Blue&amp;quot;&lt;/span&gt;))&lt;/strong&gt;
    {
        var post2 = db.Posts.FirstOrDefault();
    }

    var post3 = db.Posts.FirstOrDefault();
    
    &lt;strong&gt;ProfilerIntegration.StarStatements();&lt;/strong&gt;
    var post4 = db.Posts.FirstOrDefault();
  &lt;strong&gt;  ProfilerIntegration.StarStatementsClear();
&lt;/strong&gt;
    var post5 = db.Posts.FirstOrDefault();
}&lt;/pre&gt;
	&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }	&lt;/style&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	Which will result in:&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_8.png"&gt;&lt;img alt="image" border="0" height="359" src="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/image_thumb_3.png" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" title="image" width="628" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Disabling profiler from configuration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	You can now disable the profiler by setting:&lt;/p&gt;
&lt;blockquote&gt;
	&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;key&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;HibernatingRhinos.Profiler.Appender.NHibernate&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Disabled&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
	&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }	&lt;/style&gt;
&lt;/blockquote&gt;
&lt;p&gt;
	This will avoid initializing the profiler, obviously. The intent is that you can setup production profiling, disable it by default, and enable it selectively if you need to actually figure things out.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Odds &amp;amp; ends&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	We move to WebActivatorEx&amp;nbsp; from the deprecated WebActivator, added xml file for the appender, fixed a whole &lt;em&gt;bunch&lt;/em&gt; of small bugs, the most important among them is:&lt;/p&gt;
&lt;p&gt;
	&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/clip_image001%5B4%5D.png"&gt;&lt;img alt="clip_image001[4]" border="0" height="272" src="http://ayende.com/blog/Images/Windows-Live-Writer/The-profilers-are-back_B25A/clip_image001%5B4%5D_thumb.png" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" title="clip_image001[4]" width="289" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;
	&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Linq to SQL, Hibernate and LLBLGen Profilers, RIP&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	You might have noticed that I talked only about NHibernate and Entity Framework Profilers. The sales for the rests weren&amp;rsquo;t what we hoped they would be, and we are no longer going to sale them.&lt;/p&gt;
&lt;p&gt;
	&lt;strong&gt;Go get them, there is a new release discount&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;
	You can get the &lt;a href="http://www.hibernatingrhinos.com/products/nhprof"&gt;NHibernate Profiler&lt;/a&gt; and &lt;a href="http://www.hibernatingrhinos.com/products/efprof"&gt;Entity Framework Profiler&lt;/a&gt; for a 15% discount for the next two weeks.&lt;/p&gt;
</description><link>https://ayende.com/blog/169155/nhibernate-entity-framework-profiler-3-0?Key=79bb89d6-8948-421a-a57c-20d3cd4e716c</link><guid>https://ayende.com/blog/169155/nhibernate-entity-framework-profiler-3-0?Key=79bb89d6-8948-421a-a57c-20d3cd4e716c</guid><pubDate>Thu, 04 Dec 2014 10:00:00 GMT</pubDate></item><item><title>Working on the Uber Profiler 3.0</title><description>&lt;p&gt;One of the things that tend to get lost is the fact that Hibernating Rhinos is doing more than just working on RavenDB. The tagline we like to use is Easier Data, and the main goal we have is to provide users with better ways to access, monitor and manage their data.&lt;/p&gt; &lt;p&gt;We have started planning the next version of the Uber Profiler, that means Entity Framework Profiler, NHibernate Profiler, etc. Obviously, we’ll offer support for EF 7.0 and NHibernate 4.0, and we had gathered quite a big dataset for common errors when using an OR/M, which we intend to convert into useful guidance whenever our users run into such an issue. &lt;/p&gt; &lt;p&gt;But I realized that I was so busy working on RavenDB that I forgot to even mention the work we’ve been doing elsewhere. And I also wanted to solicit feedback about the kind of features you’ll want to see in the 3.0 version of the profilers.&lt;/p&gt;</description><link>https://ayende.com/blog/166849/working-on-the-uber-profiler-3-0?Key=99c86dc7-4ab3-41a0-b16e-0e2f09f8196d</link><guid>https://ayende.com/blog/166849/working-on-the-uber-profiler-3-0?Key=99c86dc7-4ab3-41a0-b16e-0e2f09f8196d</guid><pubDate>Wed, 28 May 2014 09:00:00 GMT</pubDate></item><item><title>Special Offer: 29% discount for all our products</title><description>&lt;p&gt;Well, it is nearly the 29 May, and that means that I have been married for two years.&lt;/p&gt; &lt;p&gt;To celebrate that, I am offering a 29% discount on all our products (&lt;a href="http://ravendb.net/buy"&gt;RavenDB&lt;/a&gt;, &lt;a href="http://www.hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt;, &lt;a href="http://www.hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;, etc).&lt;/p&gt; &lt;p&gt;All you have to do is purchase any of our products using the following coupon code: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;2nd anniversary&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This offer is valid to the end of the month, so hurry up.&lt;/p&gt;</description><link>https://ayende.com/blog/162337/special-offer-29-discount-for-all-our-products?Key=5d9dd3f7-8898-4f57-b3ab-79ee79ece958</link><guid>https://ayende.com/blog/162337/special-offer-29-discount-for-all-our-products?Key=5d9dd3f7-8898-4f57-b3ab-79ee79ece958</guid><pubDate>Sun, 26 May 2013 10:12:00 GMT</pubDate></item><item><title>Uber Prof 2.0 is OUT!</title><description>&lt;p&gt;Exactly 4 years after the 1.0 release of Uber Prof, we have the 2.0 release for Uber Prof.&lt;/p&gt; &lt;p&gt;You can find it here: &lt;a href="http://hibernatingrhinos.com/products/"&gt;http://hibernatingrhinos.com/products/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;New features include production and cloud profiling, performance improvement and better error detection &amp;amp; guidance.&lt;/p&gt;</description><link>https://ayende.com/blog/160577/uber-prof-2-0-is-out?Key=98e152f5-2a43-41d9-b560-93304ce79061</link><guid>https://ayende.com/blog/160577/uber-prof-2-0-is-out?Key=98e152f5-2a43-41d9-b560-93304ce79061</guid><pubDate>Tue, 01 Jan 2013 10:00:00 GMT</pubDate></item><item><title>Goodbye, 2012: Our end of year discount starts now!</title><description>&lt;p&gt;Well, as the year draws to a close, it is that time again, I got older, apparently. Yesterday marked my 31th trip around the sun.&lt;/p&gt; &lt;p&gt;To celebrate, I decided to give the first 31 people a &lt;strong&gt;31% discount&lt;/strong&gt; for all of our products.&lt;/p&gt; &lt;p&gt;This offer applies to:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://ravendb.net/licensing"&gt;Raven DB&lt;/a&gt; (Standard edition)&lt;/li&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/nhprof/buy"&gt;NHibernate Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/efprof/buy"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/l2sprof/buy"&gt;Linq to SQL Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://hibernatingrhinos.com/products/llblgenprof/buy"&gt;LLBLGen Profiler&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;This also applies to our support &amp;amp; consulting services.&lt;/p&gt; &lt;p&gt;All you have to do is to use the following coupon code: goodbye-2012&lt;/p&gt; &lt;p&gt;Enjoy the end of the year, and happy holidays.&lt;/p&gt;</description><link>https://ayende.com/blog/160385/goodbye-2012-our-end-of-year-discount-starts-now?Key=3cc53059-f0aa-48ca-ba7f-9131593f0f0a</link><guid>https://ayende.com/blog/160385/goodbye-2012-our-end-of-year-discount-starts-now?Key=3cc53059-f0aa-48ca-ba7f-9131593f0f0a</guid><pubDate>Fri, 21 Dec 2012 05:02:00 GMT</pubDate></item><item><title>Production Cloud Profiling With Uber Prof</title><description>&lt;p&gt;With Uber Prof 2.0 (&lt;a href="http://nhprof.com/"&gt;NHibernate Profiler&lt;/a&gt;, &lt;a href="http://efprof.com/"&gt;Entity Framework Profiler&lt;/a&gt;, &lt;a href="http://l2sprof.com/"&gt;Linq to SQL Profiler&lt;/a&gt;, &lt;a href="http://llblgenprof.com/"&gt;LLBLGen Profiler&lt;/a&gt;) we are going to bring you a new era of goodness.&lt;/p&gt; &lt;p&gt;In 1.0, we gave you a LOT of goodness for the development stage of building your application, but now we are able to take it a few steps further. Uber Prof 2.0 supports production profiling, which means that you can run it &lt;em&gt;in production&lt;/em&gt; and see what is going on &lt;em&gt;in your application now!&lt;/em&gt;&lt;/p&gt; &lt;p&gt;To make things even more interesting, we have also done a lot of work to make sure that this works on the cloud as well. For example, go ahead and look at this site: &lt;a title="http://efprof.cloudapp.net/" href="http://efprof.cloudapp.net/"&gt;http://efprof.cloudapp.net/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This is a live application, that doesn’t really do anything special, I’ll admit. But the kicker is when you go to this URL: &lt;a title="http://efprof.cloudapp.net/profiler/profiler.html" href="http://efprof.cloudapp.net/profiler/profiler.html"&gt;http://efprof.cloudapp.net/profiler/profiler.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/Cloud-Profiling-With-Uber-Prof_8519/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://ayende.com/blog/Images/Windows-Live-Writer/Cloud-Profiling-With-Uber-Prof_8519/image_thumb.png" width="944" height="315"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This is EF Prof, running on the cloud, and giving you the results that you want, &lt;em&gt;live&lt;/em&gt;. You can read all about this feature and &lt;a href="http://blog.hibernatingrhinos.com/12769/uber-prof-production-profilingndash-profiling-production-application-on-azure?key=6fc682a1295942c592ad8f11b18ec185"&gt;how to enable it here&lt;/a&gt;, but I am sure that you can see the implications. &lt;/p&gt;</description><link>https://ayende.com/blog/160321/production-cloud-profiling-with-uber-prof?Key=7504912e-62b1-4a6d-92a6-becb03303035</link><guid>https://ayende.com/blog/160321/production-cloud-profiling-with-uber-prof?Key=7504912e-62b1-4a6d-92a6-becb03303035</guid><pubDate>Tue, 18 Dec 2012 10:00:00 GMT</pubDate></item><item><title>Uber Prof V2.0 is now in Public Beta</title><description>&lt;p&gt;Well, we worked quite a bit on that, but the Uber Prof (NHibernate Profiler, Entity Framework Profiler, Linq to SQL Profiler, etc) version 2.0 are now out for public beta.&lt;/p&gt; &lt;p&gt;We made a &lt;em&gt;lot&lt;/em&gt; of improvements. Including performance, stability and responsiveness, but probably the most important thing from the user perspective is that we now support running the profiler in production, and even on the cloud.&lt;/p&gt; &lt;p&gt;We will have the full listing of all the new goodies up on the company site soon, including detailed instructions on how to enable production profiling and on cloud profiling, but I just couldn’t wait to break the news to you.&lt;/p&gt; &lt;p&gt;In fact, along with V2.0 of the profilers, we have a brand new site for our company, which you can check here: &lt;a href="http://hibernatingrhinos.com/"&gt;http://hibernatingrhinos.com/&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;To celebrate the fact that we are going on beta, we also offer a &lt;strong&gt;20%&lt;/strong&gt; discount for the duration of the beta.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Nitpicker corner, please remember that this &lt;em&gt;is&lt;/em&gt; a beta, there are bound to be problems, and we will fix them as soon as we can.&lt;/p&gt;&lt;/blockquote&gt;</description><link>https://ayende.com/blog/159425/uber-prof-v2-0-is-now-in-public-beta?Key=90fbb3f4-d674-4f99-a280-aec8792e20cb</link><guid>https://ayende.com/blog/159425/uber-prof-v2-0-is-now-in-public-beta?Key=90fbb3f4-d674-4f99-a280-aec8792e20cb</guid><pubDate>Mon, 22 Oct 2012 06:25:00 GMT</pubDate></item><item><title>Über Profiler v2.0–Private Beta is open</title><description>&lt;p&gt;Well, it took a while, but the next version of the NHibernate Profiler is ready to go to a private beta.&lt;/p&gt; &lt;p&gt;We go to private beta before the product is done, because we want to get as much early feedback as we can.&lt;/p&gt; &lt;p&gt;We have 10 spots for NHibernate Profiler v2.0 and 10 spots for Entity Framework Profiler v2.0.&lt;/p&gt; &lt;p&gt;If you are interested, please send me an email about this.&lt;/p&gt;</description><link>https://ayende.com/blog/157985/uber-profiler-v2-0-private-beta-is-open?Key=addf4b10-01f6-4b74-8f8f-c643f83b0d43</link><guid>https://ayende.com/blog/157985/uber-profiler-v2-0-private-beta-is-open?Key=addf4b10-01f6-4b74-8f8f-c643f83b0d43</guid><pubDate>Thu, 16 Aug 2012 09:00:00 GMT</pubDate></item><item><title>Gilad Shalit is back</title><description>&lt;p&gt;I don’t usually do posts about current events, but &lt;a href="http://www.ynetnews.com/articles/0,7340,L-4136451,00.html"&gt;this one is huge&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;To celebrate the event, you can use the following coupon code: SLT-45K2D4692G to get 19.41% discount (Gilad was captive for 1,941 days) for all our profilers:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://nhprof.com/"&gt;NHibernate Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://efprof.com/"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://l2sprof.com/"&gt;Linq to SQL Profiler&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://llblgenprof.com/"&gt;LLBLGen Profiler&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="http://hibernateprofiler.com/"&gt;Hibernate Profiler&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Hell, even our &lt;a href="http://nhprof.com/commercialsupport"&gt;commercial support for NHibernate&lt;/a&gt; is participating.&lt;/p&gt; &lt;p&gt;Please note that any political comment to this post that I don’t agree with will be deleted.&lt;/p&gt;</description><link>https://ayende.com/blog/130049/gilad-shalit-is-back?Key=b8b09d35-b65b-4925-9046-a6315d3899aa</link><guid>https://ayende.com/blog/130049/gilad-shalit-is-back?Key=b8b09d35-b65b-4925-9046-a6315d3899aa</guid><pubDate>Tue, 18 Oct 2011 10:00:00 GMT</pubDate></item><item><title>What is next for the profilers?</title><description>&lt;p&gt;We have been working on the profilers (&lt;a href="http://nhprof.com/"&gt;NHibernate Profiler&lt;/a&gt;, &lt;a href="http://efprof.com/"&gt;Entity Framework Profiler&lt;/a&gt;, &lt;a href="http://l2sprof.com/"&gt;Linq to SQL Profiler&lt;/a&gt;, &lt;a href="http://llblgenprof.com/"&gt;LLBLGen Profiler&lt;/a&gt; and &lt;a href="http://hibernateprofiler.com"&gt;Hibernate Profiler&lt;/a&gt;) for close to three years now. And we have been running always as 1.x, so we didn’t have a major release (although we have continual releases, we currently have close to 900 drops of the 1.x version).&lt;/p&gt; &lt;p&gt;The question now becomes, what is going to happen in the next version of the profiler?&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Production Profiling, the ability to setup your application so that you can connect to your production application and see what is going on &lt;em&gt;right now&lt;/em&gt;. &lt;/li&gt; &lt;li&gt;Error Analysis, the ability to provide you with additional insight and common solution to recurring problems.&lt;/li&gt; &lt;li&gt;Global Query Analysis, the ability to take all of your queries, look at their query plans and show your potential issues.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Those are the big ones, we have a few others, and a surprise in store &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://ayende.com/blog/Images/Windows-Live-Writer/What-is-next-for-the-profilers_868C/wlEmoticon-smile_2.png"&gt;&lt;/p&gt; &lt;p&gt;What would you want to see in the next version of the profiler?&lt;/p&gt;</description><link>https://ayende.com/blog/11265/what-is-next-for-the-profilers?Key=98ae56ef-3200-41b0-beec-1c206cbe1608</link><guid>https://ayende.com/blog/11265/what-is-next-for-the-profilers?Key=98ae56ef-3200-41b0-beec-1c206cbe1608</guid><pubDate>Thu, 02 Jun 2011 09:00:00 GMT</pubDate></item><item><title>Uber Prof &amp; NuGet</title><description>&lt;p&gt;Fitzchak has all the details in our &lt;a href="http://blogs.hibernatingrhinos.com/archive/2011/03/31/nuget-packages-and-an-example-use-of-the-profiler.aspx"&gt;company blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;img alt="NugetPackages" src="http://blogs.hibernatingrhinos.com/images/blogs_hibernatingrhinos_com/Windows-Live-Writer/33b8e30a3166_9ED0/NugetPackages_thumb_1.png" /&gt;&lt;/p&gt;</description><link>https://ayende.com/blog/4799/uber-prof-nuget?Key=e4deb5ce-de52-4c43-89ba-2c3f410d2801</link><guid>https://ayende.com/blog/4799/uber-prof-nuget?Key=e4deb5ce-de52-4c43-89ba-2c3f410d2801</guid><pubDate>Fri, 01 Apr 2011 11:00:00 GMT</pubDate></item><item><title>NHibernate Profiler update: Client Profile &amp; NHibernate 3.x updates</title><description>&lt;p&gt;We just finished a pretty major change to how the &lt;a href="http://nhprof.com"&gt;NHibernate Profiler&lt;/a&gt; interacts with NHibernate. That change was mostly driven out of the desire to fully support running under the client profile and to allow us to support the new logging infrastructure in NHibernate 3.x.&lt;/p&gt;  &lt;p&gt;The good news, this is done &lt;img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://ayende.com/Blog/images/ayende_com/Blog/Windows-Live-Writer/6f0d21354309_E22E/wlEmoticon-smile_2.png" /&gt;, you can now use NH Prof from the client profile, and you don’t need to do anything to make it work for NHibernate 3.x.&lt;/p&gt;  &lt;p&gt;The slightly bad news is that if you were relying on log4net conifguration to configure NH Prof, there is a breaking change that affects you. Basically, you need to update your configuration. You can find the full details on how to do this in the &lt;a href="http://nhprof.com/Learn/Usage/ProfileAppWithConfiguration"&gt;documentation&lt;/a&gt;.&lt;/p&gt;</description><link>https://ayende.com/blog/4780/nhibernate-profiler-update-client-profile-nhibernate-3-x-updates?Key=b9fed313-c182-4419-8eb4-398335fe7369</link><guid>https://ayende.com/blog/4780/nhibernate-profiler-update-client-profile-nhibernate-3-x-updates?Key=b9fed313-c182-4419-8eb4-398335fe7369</guid><pubDate>Sun, 13 Mar 2011 14:28:00 GMT</pubDate></item><item><title>New Profiler Feature: Avoid Writes from Multiple Sessions In The Same Request</title><description>&lt;p&gt;Because I keep getting asked, this feature is available for the following profilers:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://nhprof.com/"&gt;NHibernate Profiler&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://efprof.com/"&gt;Entity Framework Profiler&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://l2sprof.com/"&gt;Linq to SQL Profiler&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://llblgenprof.com/"&gt;LLBLGen Profiler&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://hibernateprofiler.com/"&gt;Hibernate Profiler&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This new feature detects a very interesting bad practice, write to the database from multiple session in the same web request.&lt;/p&gt;  &lt;p&gt;For example, consider the following code:&lt;/p&gt;  &lt;blockquote&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SaveAccount(Account account)
{
    &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = sessionFactory.OpenSession())
    &lt;span class="kwrd"&gt;using&lt;/span&gt;(session.BeginTransaction())
    {
           session.SaveOrUpdate(account);
           session.Transaction.Commit();    
    }
}&lt;/pre&gt;

  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; Account GetAccount(&lt;span class="kwrd"&gt;int&lt;/span&gt; id)
{
    &lt;span class="kwrd"&gt;using&lt;/span&gt;(var session = sessionFactory.OpenSession())
    {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; session.Get&amp;lt;Account&amp;gt;(id);
    }
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;It is bad for several reasons, micro managing the session is just one of them, but the worst part is yet to come…&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; MakePayment(&lt;span class="kwrd"&gt;int&lt;/span&gt; fromAccount, &lt;span class="kwrd"&gt;int&lt;/span&gt; toAccount, &lt;span class="kwrd"&gt;decimal&lt;/span&gt; ammount)
{
    var from = Dao.GetAccount(fromAccount);
    var to = Dao.GetAccount(toAccount);
    from.Total -= amount;
    to.Total += amount;
    Dao.SaveAccount(from);
    Dao.SaveAccount(to);
}&lt;/pre&gt;
  &lt;style type="text/css"&gt;&lt;![CDATA[
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }]]&gt;&lt;/style&gt;&lt;/blockquote&gt;

&lt;p&gt;Do you see the error here? There are actually several, let me count them:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;We are using 4 different connections to the database in a single method.&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;We don’t have transactional safety!!!!&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think about it, if the server crashed between the fifth and sixth lines of this method, where would we be? &lt;/p&gt;

&lt;p&gt;We would be in that wonderful land where money disappear into thin air and we stare at that lovely lawsuit folder and then jump from a high window to a stormy sea.&lt;/p&gt;

&lt;p&gt;Or, of course, you could use the profiler, which will tell you that you are doing something which should be avoided:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/Windows-Live-Writer/New-Alert-Multiple-Write-Sessions-In-The_C8D8/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/Windows-Live-Writer/New-Alert-Multiple-Write-Sessions-In-The_C8D8/image_thumb.png" width="775" height="110" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Isn’t that better than swimming with the sharks?&lt;/p&gt;</description><link>https://ayende.com/blog/4775/new-profiler-feature-avoid-writes-from-multiple-sessions-in-the-same-request?Key=7f102633-ec3a-497f-b84f-8c191dab2292</link><guid>https://ayende.com/blog/4775/new-profiler-feature-avoid-writes-from-multiple-sessions-in-the-same-request?Key=7f102633-ec3a-497f-b84f-8c191dab2292</guid><pubDate>Tue, 01 Mar 2011 12:26:00 GMT</pubDate></item></channel></rss>