<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Stefan Sedich's Blog</title><subtitle type="html">try { Stefan.Code(); } 
catch(BadCodeException) { NotLikely(); }</subtitle><id>http://weblogs.asp.net/stefansedich/atom.aspx</id><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/default.aspx" /><link rel="self" type="application/atom+xml" href="http://weblogs.asp.net/stefansedich/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20510.895">Community Server</generator><updated>2008-10-22T16:04:00Z</updated><entry><title>Why I fell in love with NSubstitute in the first 10 seconds</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2011/05/24/why-i-fell-in-love-with-nsubstitute-in-the-first-10-seconds.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2011/05/24/why-i-fell-in-love-with-nsubstitute-in-the-first-10-seconds.aspx</id><published>2011-05-23T21:23:00Z</published><updated>2011-05-23T21:23:00Z</updated><content type="html">I must have been hiding under a rock or something but until today I have been a Rhino Mocks aficionado. I had tried Moq and not liked it and heard about NSubstitute but never bothered to go off and look at what it looks like.
&lt;br /&gt;&lt;br /&gt;
Read more on my new blog &lt;a href="http://www.stefansedich.com/2011/05/why-i-fell-in-love-with-nsubstitute-in.html"&gt;http://www.stefansedich.com/2011/05/why-i-fell-in-love-with-nsubstitute-in.html&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7801357" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author></entry><entry><title>Easy temporary data in NHibernate integration tests</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2011/05/24/easy-temporary-data-in-nhibernate-integration-tests.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2011/05/24/easy-temporary-data-in-nhibernate-integration-tests.aspx</id><published>2011-05-23T21:22:00Z</published><updated>2011-05-23T21:22:00Z</updated><content type="html">Last week working on a project I noticed that our integration tests had some messy clean-up code. Basically the tests were creating data in the database and then were responsible for cleaning up the data.........
&lt;br /&gt;&lt;br /&gt;
Read more on my new blog: &lt;a href="http://www.stefansedich.com/2011/05/easy-temporary-data-in-nhibernate.html"&gt;http://www.stefansedich.com/2011/05/easy-temporary-data-in-nhibernate.html&lt;/a&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7801356" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author></entry><entry><title>So I Created Another Utils Library</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2010/07/12/so-i-created-another-utils-library.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2010/07/12/so-i-created-another-utils-library.aspx</id><published>2010-07-12T11:39:00Z</published><updated>2010-07-12T11:39:00Z</updated><content type="html">Thought it was time I start my own Utils library (why not everyone else seems to have one), I have things like a UnitOfWork implementation, base Repository class, and plan to add more things as I go.
&lt;br  /&gt;&lt;br /&gt;
This is still a work in progress and I would appreciate any feedback out there, in the meantime I will continue my work on it.
&lt;br  /&gt;&lt;br /&gt;
You can find the project on GitHub @ &lt;a href="http://github.com/stefansedich/YetAnotherUtilsLib"&gt;http://github.com/stefansedich/YetAnotherUtilsLib&lt;/a&gt;
&lt;br  /&gt;&lt;br /&gt;&lt;br /&gt;
Cheers
&lt;br /&gt;
Stefan&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7562896" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="NHibernate" scheme="http://weblogs.asp.net/stefansedich/archive/tags/NHibernate/default.aspx" /><category term="Windsor" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Windsor/default.aspx" /></entry><entry><title>In Memory SQLite + Unit Test + FluentNHibernate</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2010/07/11/in-memory-sqlite-unit-test-fluentnhibernate.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2010/07/11/in-memory-sqlite-unit-test-fluentnhibernate.aspx</id><published>2010-07-11T04:05:00Z</published><updated>2010-07-11T04:05:00Z</updated><content type="html">&lt;b&gt;UPDATE:&lt;/b&gt;
&lt;br /&gt;&lt;br /&gt;
I have forked fluent NH here: http://github.com/stefansedich/fluent-nhibernate, and added a change so we can just use:
&lt;br /&gt;&lt;br /&gt;
.Database(SQLiteConfiguration.Standard.InMemory().ShowSql())
&lt;br /&gt;&lt;br /&gt;
By default the InMemory() helper will now add the pooling support, I sent a push request, so hopefully this hits trunk. Not
sure if I was being silly but I do not see a need where you would not pool in memory SQLite anyway.
&lt;br /&gt;&lt;br /&gt;
----------------------------------------------------------
&lt;br /&gt;&lt;br /&gt;
Just playing around with FNH for the first time, getting my unit tests running proved to be a pain, did a Google and had no luck finding a solution to my problem.
&lt;br /&gt;&lt;br /&gt;
A quick play using the fluent config I found a way to get it working, my full session factory setup is below:
&lt;br /&gt;&lt;br /&gt;
 public ISessionFactory GetSessionFactory()
            {
                return Fluently.Configure()
                    .Database(SQLiteConfiguration.Standard.InMemory()
                                  .ConnectionString("Data Source=:memory:;Version=3;New=True;Pooling=True;Max Pool Size=1;"))
                    .Mappings(m =&gt; m.FluentMappings.AddFromAssembly(typeof(CustomerRepository).Assembly))
                    .ExposeConfiguration(config =&gt; new SchemaExport(config).Create(true, true))
                    .BuildSessionFactory();
            }
&lt;br /&gt;&lt;br /&gt;
The key was to set the Pooling=True;Max PoolSize=1; in my config, looking at fluent NH the .InMemory() shortcut seems to not set these:
&lt;br /&gt;&lt;br /&gt;
public SQLiteConfiguration InMemory()
        {
            Raw("connection.release_mode", "on_close");
            return ConnectionString(c =&gt; c
                .Is("Data Source=:memory:;Version=3;New=True;"));            
        }
&lt;br /&gt;&lt;br /&gt;
Guess it would be great if it did, but for the time being I will just do it manually.
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
Cheers
&lt;br /&gt;
Stefan


&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7561486" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="NHibernate" scheme="http://weblogs.asp.net/stefansedich/archive/tags/NHibernate/default.aspx" /><category term="Fluent NHibernate" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Fluent+NHibernate/default.aspx" /></entry><entry><title>NHibernate Session Management using FluentNhibernate and Castle Windsor</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2010/07/11/nhibernate-session-management-using-fluentnhibernate-and-castle-windsor.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2010/07/11/nhibernate-session-management-using-fluentnhibernate-and-castle-windsor.aspx</id><published>2010-07-11T01:49:00Z</published><updated>2010-07-11T01:49:00Z</updated><content type="html">Time for my first post in a while, thought I would post on session management using Castle Windsor. 
&lt;br /&gt;&lt;br /&gt;
I found this good post, http://blog.stevehorn.cc/2009/03/fluent-nhibernate-configured-via.html and I have basically converted it to use Castle for IoC instead.
&lt;br /&gt;&lt;br /&gt;
The Windsor config that will work is below:
&lt;br /&gt;&lt;br /&gt;
var container = new WindsorContainer();
&lt;br /&gt;
container.AddFacility&lt;Castle.Facilities.FactorySupport.FactorySupportFacility&gt;(); // This adds support to be able to use the UsingFactoryMethod.
&lt;br /&gt;&lt;br /&gt;
container.Register(Component.For&lt;INHibernateSessionFactoryBuilder&gt;().ImplementedBy&lt;NHibernateSessionFactoryBuilder&gt;().LifeStyle.Singleton);
&lt;br /&gt;
container.Register(Component.For&lt;ISession&gt;().UsingFactoryMethod(x =&gt; x.Resolve&lt;INHibernateSessionFactoryBuilder&gt;()
                                                                      .GetSessionFactory()
                                                                      .OpenSession()).LifeStyle.PerWebRequest);
&lt;br /&gt;&lt;br /&gt;
The only other addition that is needed for Windsor is to add the PerWebRequest module to your Web.config file in the httpModules section:
&lt;br /&gt;&lt;br /&gt;
&amp;lt;add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.MicroKernel" /&amp;gt;
&lt;br /&gt;&lt;br /&gt;

And you are done, nice and simple NHibernate Session management using a Windsor container.

&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;

Cheers
Stefan

&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7561359" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="Windsor" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Windsor/default.aspx" /></entry><entry><title>Mammoth VPS launches Backups, DNS Management and more!!!</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2010/05/20/mammothvps-launches-backups-dns-management-and-more.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2010/05/20/mammothvps-launches-backups-dns-management-and-more.aspx</id><published>2010-05-19T23:24:00Z</published><updated>2010-05-19T23:24:00Z</updated><content type="html">Yesterday we launched a bunch of new features over at MammothVPS,

&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;

- All VPS' now have an on-site, off-server backup facility available to them. By default all customers will have 1 free weekly backup made available to them, and should you wish to
  you can purchase more slots which are available in daily, weekly and monthly schedules. 
&lt;br /&gt;&lt;br /&gt;
- DNS hosting has been made available and will be free for all customers. You can find the new interface in your mPanel.
&lt;br /&gt;&lt;br /&gt;
- A cleanup of the menu system has been done to make it easier to navigate around both the site and mPanel.
&lt;br /&gt;&lt;br /&gt;
- You will find new sections on site, we now have more information about our services and have included things like a Knowledge Base, which will 
  provide information on howto setup various applications on your VPS.
&lt;br /&gt;&lt;br /&gt;
- Added the ability to change the kernel your VPS is running on.

&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;

So head on over to &lt;a href="http://mammothvps.com.au"&gt;MammothVPS&lt;/a&gt; and check it out.

&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7490629" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET/default.aspx" /><category term="Brisbane" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Brisbane/default.aspx" /><category term="VPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/VPS/default.aspx" /><category term="Mammoth VPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Mammoth+VPS/default.aspx" /><category term="Mammoth" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Mammoth/default.aspx" /><category term="MammothVPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/MammothVPS/default.aspx" /></entry><entry><title>Mammoth VPS Signup Video</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2010/05/17/mammothvps-signup-video.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2010/05/17/mammothvps-signup-video.aspx</id><published>2010-05-17T01:07:00Z</published><updated>2010-05-17T01:07:00Z</updated><content type="html">We have posted a &lt;a href="http://www.youtube.com/watch?v=KcelKjzzZAo"&gt;video&lt;/a&gt; showing the process involved in signing up for a VPS at check it out below.
&lt;br /&gt;&lt;br /&gt;
&lt;object width="480" height="385"&gt;&lt;param name="movie" value="http://www.youtube.com/v/KcelKjzzZAo&amp;hl=en_US&amp;fs=1&amp;"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/KcelKjzzZAo&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;br /&gt;&lt;br /&gt;
As a special offer if you use the voucher code 'VIDEO' you can signup and receive 10% off for the first 12 months of your service.
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
Cheers
Stefan

&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7486139" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET/default.aspx" /><category term="VPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/VPS/default.aspx" /><category term="VIDEO" scheme="http://weblogs.asp.net/stefansedich/archive/tags/VIDEO/default.aspx" /><category term="Mammoth VPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Mammoth+VPS/default.aspx" /><category term="Mammoth" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Mammoth/default.aspx" /><category term="MammothVPS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/MammothVPS/default.aspx" /></entry><entry><title>Unit Testing ASP.NET? ASP.NET unit testing has never been this easy</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2009/05/19/unit-testing-asp-net-asp-net-unit-testing-has-never-been-this-easy.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2009/05/19/unit-testing-asp-net-asp-net-unit-testing-has-never-been-this-easy.aspx</id><published>2009-05-19T00:41:00Z</published><updated>2009-05-19T00:41:00Z</updated><content type="html">&lt;br&gt;&lt;a href="http://www.typemock.com/" mce_href="http://www.typemock.com/"&gt;Unit Testing&lt;/a&gt; ASP.NET? &lt;a href="http://www.typemock.com/ASP.NET_unit_testing_page.php" mce_href="http://www.typemock.com/ASP.NET_unit_testing_page.php"&gt;ASP.NET unit testing&lt;/a&gt; has never been this easy.&lt;br&gt;&lt;br&gt;Typemock is launching a new product for ASP.NET developers – the &lt;strong&gt;ASP.NET Bundle&lt;/strong&gt; - and for the launch will be giving out &lt;span style="color: rgb(0, 102, 0);"&gt;&lt;strong&gt;FREE licenses&lt;/strong&gt;&lt;/span&gt; to bloggers and their readers.&lt;br&gt;&lt;br&gt;The ASP.NET Bundle is the ultimate ASP.NET unit testing solution, and offers both &lt;a href="http://www.typemock.com/" mce_href="http://www.typemock.com/"&gt;Typemock Isolator&lt;/a&gt;, a &lt;a href="http://www.typemock.com/" mce_href="http://www.typemock.com/"&gt;unit test&lt;/a&gt; tool and &lt;a href="http://sm-art.biz/Ivonna.aspx" mce_href="http://sm-art.biz/Ivonna.aspx"&gt;Ivonna&lt;/a&gt;, the Isolator add-on for &lt;a href="http://sm-art.biz/Ivonna.aspx" mce_href="http://sm-art.biz/Ivonna.aspx"&gt;ASP.NET unit testing&lt;/a&gt;, for a bargain price.&lt;br&gt;&lt;br&gt;Typemock Isolator is a leading &lt;a href="http://www.typemock.com/" mce_href="http://www.typemock.com/"&gt;.NET unit testing&lt;/a&gt; tool (C# and VB.NET) for many ‘hard to test’ technologies such as &lt;a href="http://typemock.com/sharepointpage.php" mce_href="http://typemock.com/sharepointpage.php"&gt;SharePoint&lt;/a&gt;, &lt;a href="http://www.typemock.com/ASP.NET_unit_testing_page.php" mce_href="http://www.typemock.com/ASP.NET_unit_testing_page.php"&gt;ASP.NET&lt;/a&gt;, &lt;a href="http://www.typemock.com/ASP.NET_unit_testing_page.php" mce_href="http://www.typemock.com/ASP.NET_unit_testing_page.php"&gt;MVC&lt;/a&gt;, &lt;a href="http://www.typemock.com/wcfpage.php" mce_href="http://www.typemock.com/wcfpage.php"&gt;WCF&lt;/a&gt;, WPF, &lt;a href="http://www.typemock.com/Silverlight_unit_testing_page.php" mce_href="http://www.typemock.com/Silverlight_unit_testing_page.php"&gt;Silverlight&lt;/a&gt; and more. Note that for &lt;a href="http://www.typemock.com/Silverlight_unit_testing_page.php" mce_href="http://www.typemock.com/Silverlight_unit_testing_page.php"&gt;unit testing Silverlight&lt;/a&gt; there is an open source Isolator add-on called &lt;a href="http://www.typemock.com/Silverlight_unit_testing_page.php" mce_href="http://www.typemock.com/Silverlight_unit_testing_page.php"&gt;SilverUnit&lt;/a&gt;.&lt;br&gt;&lt;br&gt;The first 60 bloggers who will blog this text in their blog and &lt;a href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html" mce_href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html"&gt;tell us about it&lt;/a&gt;, will get a Free Isolator ASP.NET Bundle license (Typemock Isolator + Ivonna). If you post this in an ASP.NET &lt;strong&gt;dedicated&lt;/strong&gt; blog, you'll get a license automatically (even if more than 60 submit) during the first week of this announcement.&lt;br&gt;&lt;br&gt;Also 8 bloggers will get an &lt;strong&gt;additional 2 licenses&lt;/strong&gt; (each) to give away to their readers / friends.&lt;br&gt;&lt;br&gt;Go ahead, click the following link for &lt;a href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html" mce_href="http://blog.typemock.com/2009/05/get-free-typemock-licenses-aspnet.html"&gt;more information &lt;/a&gt;on how to get your free license.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&lt;/span&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7092440" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="Typemock" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Typemock/default.aspx" /><category term="Unit Testing" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Unit+Testing/default.aspx" /><category term="TDD" scheme="http://weblogs.asp.net/stefansedich/archive/tags/TDD/default.aspx" /></entry><entry><title>New Year Means A Change!!</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/12/22/times-of-change.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/12/22/times-of-change.aspx</id><published>2008-12-22T11:23:00Z</published><updated>2008-12-22T11:23:00Z</updated><content type="html">&lt;p&gt;Hello All, &lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;I am happy that next year is going to be a time of great change for me, I have decided it is time to move on from my home town of Perth, Australia. And am making the 4,000 odd KM journey to Brisbane, as depicted in my map kindly donated from google maps and constructed using my ms paint skills. The jorney begins in Perth (Red Dot) and ends in Brisbane (Green Dot).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/stefansedich/journey%20map.jpg" mce_href="http://weblogs.asp.net/blogs/stefansedich/journey%20map.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/stefansedich/journey%20map.jpg" mce_src="http://weblogs.asp.net/blogs/stefansedich/journey%20map.jpg" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have been offered an excellent opportunity at a Brisbane company and I think the new year will bring me a lot of new challenges.&lt;br&gt;&lt;br&gt;What is better than a fresh start to a new year, stay tuned as I hope to ramp up my blogging in the new year and have some exciting projects/ideas on the way :).&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers&lt;br&gt;Stefan&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6800666" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term="Brisbane" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Brisbane/default.aspx" /><category term="Moving" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Moving/default.aspx" /><category term="Change" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Change/default.aspx" /></entry><entry><title>Long time no post, here is something for fun, any object to a dictionary using an extension method!</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/12/09/long-time-no-post-here-is-something-for-fun-any-object-to-a-dictionary-using-an-extension-method.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/12/09/long-time-no-post-here-is-something-for-fun-any-object-to-a-dictionary-using-an-extension-method.aspx</id><published>2008-12-09T14:35:00Z</published><updated>2008-12-09T14:35:00Z</updated><content type="html">&lt;p&gt;Long time no post again :(, I will be getting back into it very soon if I can :).&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I was a little bored tonight so I thought I would share my extension method for converting an object to a dictionary, mainly used to converting an anon type to a dictionary &lt;br&gt;for my url helper, i.e. new { id = 1, name = "bob" } will be converted to a key value dictionary, the extension method is as follows:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;public static class Extensions {&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&amp;lt;summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /// Converts an object to a dictionary based on its properties.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&amp;lt;/summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static IDictionary&amp;lt;string, object&amp;gt; ToDictionary(this object value) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dictionary = new Dictionary&amp;lt;string, object&amp;gt;();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var prop in value.GetType().GetProperties()) {&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // For each property on the type get the name and value.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var val = prop.GetValue(value, null);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dictionary.Add(prop.Name, val);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dictionary;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And to use. do this:&lt;/p&gt;&lt;p&gt;var item = new { id = 1, name = "22"};&lt;br&gt;var itemDict = item.ToDictionary();&lt;br&gt;&lt;br&gt;&lt;br&gt;This will return a dictionary from the type, but where this might also work is if you have a class say Person with 2 properties ID and Name, p.ToDictionary() will return a dictionary with Id and Name in it from the Person class.&lt;br&gt;&lt;br&gt;&lt;br&gt;Not terribly useful (I guess you could just use the RouteValueDictionary from the System.Web.Routing library, unless there is another way too), but it was helpful to me :)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers&lt;br&gt;Stefan&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6775177" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="Extension Methods" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Extension+Methods/default.aspx" /></entry><entry><title>Lazy Loaded One-To-One With NHibernate </title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/11/13/lazy-loaded-one-to-one-with-nhibernate.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/11/13/lazy-loaded-one-to-one-with-nhibernate.aspx</id><published>2008-11-13T12:46:00Z</published><updated>2008-11-13T12:46:00Z</updated><content type="html">&lt;p&gt;&lt;b&gt;UPDATE 20081114&lt;br&gt;&lt;/b&gt;&lt;br&gt;The one-to-one solution I had posted turned out not to work for updates, :(, in the end I had to use a many-to-one map with a unique foreign key association to get this to work, the updated example is below. Sorry for my EPIC FAIL :)...&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;G'day,&lt;/p&gt;&lt;p&gt;I am working on something at the moment and I am storing BLOB data for documents in the database, I am storing things like name and data which is a binary field. |&lt;br&gt;Now I wan't to load the binary data as loading this all the time is very inneficient. So to get this to work I had to split this to two tables, one with my meta data and another one-to-one&lt;br&gt;table to store the BLOB. NOW the fun began I created the two tables:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;Documents&lt;br&gt;-------------------&lt;br&gt;(PK) Id&lt;br&gt;(FK Unique) DocumentFileId&lt;br&gt;Name&lt;br&gt;&lt;br&gt;DocumentFiles&lt;br&gt;-------------------&lt;br&gt;(PK) Id&lt;br&gt;Data&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;From this I created my POCO classes for the Document and DocumentFile map.&lt;br&gt;&lt;/p&gt;&lt;p&gt;public class Document {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int Id { get; set; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name { get; set; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DocumentFile DocumentFile { get; set; }&amp;nbsp;&amp;nbsp; &lt;br&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;public class DocumentFile {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public virtual int Id { get; set; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public virtual Document Document { get; set; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public virtual byte[] Data { get; set; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;} &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;Now on to the mappings, I thought this would be as easy as created a one-to-one mapping with lazy="proxy" set on the one-to-one on the Document class but this was not the case. &lt;br&gt;You NEED to set constrained="true" on the mapping, basically going from this post I found: &lt;a href="http://www.hibernate.org/162.html#A5" mce_href="http://www.hibernate.org/162.html#A5"&gt;http://www.hibernate.org/162.html#A5&lt;/a&gt;. Say we have A-&amp;gt;B where this is a 1-1 relationship,&lt;br&gt;now without a constraint from A-B this means A can exist without B, so there is a possiblity that B is null, a Proxy to B will be not null and won't work here.&lt;br&gt;&lt;br&gt;But when we know A and B will always belong together it is ok to create a Proxy for B. Now my final mapping files looks like so:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;BUUUT&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp; &lt;/b&gt;&lt;/i&gt;as I soon found out if in the A mapping you constrain B it will mean it will try to insert B first and fail to generate a primary key with the foreign key generator, hence not working as expected, I had to change the mappings to use a many-to-one unique foreign key mapping to get this to work. I updated the mappings below, the main differences are highlighted below:&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;&amp;lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;class name="NHibernateDocumentTest.Document, NHibernateDocumentTest" table="Documents" lazy="false"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;id name="Id" column="Id" type="integer"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;generator class="native" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/id&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="Name" column="Name" type="string" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&lt;b&gt;&amp;nbsp; &amp;lt;many-to-one name="DocumentFile" cascade="all-delete-orphan" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lazy="proxy" column="DocumentFileId" unique="true" /&amp;gt;&lt;/b&gt;&lt;br&gt;&amp;nbsp; &amp;lt;/class&amp;gt;&lt;br&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;class name="NHibernateDocumentTest.DocumentFile, NHibernateDocumentTest" table="DocumentFiles" lazy="true"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt; &amp;lt;id name="Id" column="Id" type="integer"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;generator class="native" /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/id&amp;gt;&amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="Data" column="Data" type="Byte[]" /&amp;gt;&lt;br&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;one-to-one name="Document" constrained="true" property-ref="DocumentFile" /&amp;gt;&lt;/b&gt;&lt;br&gt;&amp;nbsp; &amp;lt;/class&amp;gt;&lt;br&gt;&amp;lt;/hibernate-mapping&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;br&gt;And then we are done, this works fine. So the trick is for a one-to-one to work with Lazy loading you must use a unique foreign key associated with a many-to-one mapping to your child.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks&lt;br&gt;Stefan&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6733035" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="NHibernate" scheme="http://weblogs.asp.net/stefansedich/archive/tags/NHibernate/default.aspx" /></entry><entry><title>Day Of Frustration</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/11/09/day-of-frustration.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/11/09/day-of-frustration.aspx</id><published>2008-11-09T03:25:00Z</published><updated>2008-11-09T03:25:00Z</updated><content type="html">&lt;p&gt;&amp;lt;Rant&amp;gt; &lt;br&gt;&lt;/p&gt;&lt;p&gt;I am in the process of playing around with the routing library for my current project, and I am playing around with using routing for web forms. I was running in IIS7 Classic mode (Don't ask why integrated works fine but I was seeing how this would work in IIS6 by testing with classic mode), I added a wild card mapping so that all requests would run through the asp.net pipeline and it just would not work. &lt;/p&gt;&lt;p&gt;I litterally banged my head against the wall for hours and no matter what I did the requests were not running through the pipeline. My dev machine is running vista 64bit and I never even though of this, when I was mapping the wildcard I was mapping to the 32bit framework. Argh, I luckily found the option in IIS to enable 32 bit applications and this fixed all my problems.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;A day of headache and a click to the solution, I love doing this sometimes :P&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/Rant&amp;gt; &lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6726995" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="IIS" scheme="http://weblogs.asp.net/stefansedich/archive/tags/IIS/default.aspx" /></entry><entry><title>Avoid Memory Leaks When Using Windsor And Not Releasing Objects</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/11/05/avoid-memory-leaks-when-using-windsor-and-not-releasing-objects.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/11/05/avoid-memory-leaks-when-using-windsor-and-not-releasing-objects.aspx</id><published>2008-11-05T04:05:00Z</published><updated>2008-11-05T04:05:00Z</updated><content type="html">&lt;p&gt;I just had this issue in a project I am working on (ASP.NET Webforms Application), yesterday I ran a load test and watched my memory climb rapidly and max out not long after. I am using Castle Windsor for my IOC and mostly transient instances are registered so I did not expect any issues here as I asssumed there would be no references held to my transient instances but the leak shows this is happening. &lt;br&gt;&lt;br&gt;I am not releasing my services once done so this is partly my fault but I do not wan't to explicitly release them so I found another way which means setting the ReleasePolicy on the kernel to use the NoTrackingReleasePolicy. The default release policy is the AllComponentsReleasePolicy which from what I can see by debugging will keep track of your instances and you will need to release them manually when you are finished with the item. &lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;b&gt;Simple Fix Using NoTrackingReleasePolicy&lt;/b&gt;&lt;/p&gt;&lt;p&gt;To use this when creating your kernel set the array resolver like so to use the NoTrackingReleasePolicy for its release policy.&lt;br&gt;&lt;/p&gt;&lt;p&gt;// Create.&lt;br&gt;IKernel kernel = new DefaultKernel();&lt;br&gt;&lt;br&gt;// Set release policy.&lt;br&gt; kernel.ReleasePolicy = new NoTrackingReleasePolicy();&lt;/p&gt;&lt;p&gt;&lt;br&gt;Now my application does not leak and is stable. I am not 100% if this is the best way to handle this and if I should actually release but it is working a charm. Funny to think what would have happened if I never checked memory use like I know happens out there :\ would have been interested, and all it took was something simple to fix.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Cheers&lt;br&gt;Stefan&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6721177" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="Castle" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Castle/default.aspx" /><category term="Windsor" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Windsor/default.aspx" /></entry><entry><title>Bug with Latest Google Chrome and ASP.NET Validation</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/11/04/bug-with-latest-google-chrome-and-asp-net-validation.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/11/04/bug-with-latest-google-chrome-and-asp-net-validation.aspx</id><published>2008-11-04T13:48:00Z</published><updated>2008-11-04T13:48:00Z</updated><content type="html">&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;This is something that drove me insane today, I have a
dropdown control with a required field validator on this control. the
dropdown is also set to autopostback. Now up until after lunch today
this was working fine in chrome but after lunch it stopped. Turns out
my Chrome updated to the latest version which seemed to break
validation in the case which is shown below try the below on a page in
the latest Chrome you will see that a postback will not happen, remove
the validator and postback will work just fine.&lt;br&gt;&lt;br&gt;&lt;/p&gt;&lt;pre&gt;Selected: &amp;lt;%= DropDown.SelectedValue %&amp;gt;&lt;br&gt;&amp;lt;asp:DropDownList ID="DropDown" runat="server" AutoPostBack="true"&amp;gt;&lt;br&gt;    &amp;lt;asp:ListItem Value="" Text=""&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br&gt;    &amp;lt;asp:ListItem Value="0" Text="0"&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br&gt;    &amp;lt;asp:ListItem Value="1" Text="1"&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br&gt;    &amp;lt;asp:ListItem Value="2" Text="2"&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br&gt;&amp;lt;/asp:DropDownList&amp;gt;    &lt;br&gt;&amp;lt;asp:RequiredFieldValidator ID="RequiredTest" runat="server" ControlToValidate="DropDown" ErrorMessage="Must Select Item"&amp;gt;&lt;br&gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;    &amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;/pre&gt;&lt;pre&gt;I thought this must be an issue in the validation library for ASP.NET and after time narrowed it down to the ValidatorHookupEvent method in the library:&lt;/pre&gt;&lt;pre&gt;&lt;br&gt;function ValidatorHookupEvent(control, eventType, functionPrefix) {&lt;br&gt;            var ev;&lt;br&gt;&lt;br&gt;            eval("ev = control." + eventType + ";");&lt;br&gt;           &lt;br&gt;            if (typeof (ev) == "function") {&lt;br&gt;                ev = ev.toString();&lt;br&gt;                ev = ev.substring(ev.indexOf("{") + 1, ev.lastIndexOf("}"));&lt;br&gt;            }&lt;br&gt;            else {&lt;br&gt;                ev = "";&lt;br&gt;            }&lt;br&gt;&lt;br&gt;            var func;&lt;br&gt;            if (navigator.appName.toLowerCase().indexOf('explorer') &amp;gt; -1) {&lt;br&gt;                func = new Function(functionPrefix + " " + ev);&lt;br&gt;            } else {&lt;br&gt;                &lt;b&gt;func = new Function("event", functionPrefix + " " + ev);&lt;/b&gt;&lt;br&gt;            }&lt;br&gt;            &lt;br&gt;            eval("control." + eventType + " = func;");&lt;br&gt;        }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;br&gt;Now the line in bold is in question: &lt;b&gt;func = new Function("event", functionPrefix + " " + ev);&lt;/b&gt;, this is wrapping the ev argument which is the original&lt;br&gt;onchange event on the dropdown in our case the postback and the ValidatorOnChange method, if you look at how chrome wraps the function in the&lt;br&gt;onchange when you view the value of func after it has wrapped the two together:&lt;br&gt;&lt;/pre&gt;&lt;pre&gt;function anonymous(event) { ValidatorOnChange(event); with (this.ownerDocument ? this.ownerDocument : {}) { with (this.form ? this.form : {}) { with (this) { return (function(evt){javascript:setTimeout('__doPostBack(\'DropDown\',\'\')', 0)}).call(this, evt); } } } } &lt;br&gt;&lt;br&gt;&lt;/pre&gt;&lt;pre&gt;And in firefox the wrapping is not like chrome as you can see chrome has an evt argument where firefox is different:&lt;/pre&gt;&lt;pre&gt;function anonymous(event) { ValidatorOnChange(event);javascript: setTimeout("__doPostBack('DropDown','')", 0); } &lt;/pre&gt;&lt;pre&gt;&lt;br&gt;&lt;/pre&gt;&lt;pre&gt;Now the thing to note in Chrome look at the onchange of the dropdown, say alert the items onchange event to view what it looks like, it has an evt argument which seems to cause the issue.&lt;br&gt;&lt;br&gt;function onchange(evt) {&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with (this.ownerDocument ? this.ownerDocument : {}) { with (this.form ? this.form : {}) { with (this) { return (function(evt){javascript:setTimeout('__doPostBack(\'DropDown\',\'\')', 0)}).call(this, evt); } } } &lt;/pre&gt;&lt;pre&gt;} &amp;nbsp; &lt;br&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br&gt;In firefox the onchange in firefox it uses an event argument and not evt like chrome.&lt;/pre&gt;&lt;pre&gt;function onchange(event) {&lt;br&gt;    javascript: setTimeout("__doPostBack('DropDown','')", 0);&lt;br&gt;}&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;br&gt;I found a simmilar problem and got an answer: &lt;a href="http://code.google.com/p/chromium/issues/detail?can=2&amp;amp;q=&amp;amp;colspec=ID%20Stars%20Pri%20Area%20Type%20Status%20Summary%20Modified%20Owner&amp;amp;sort=&amp;amp;id=650" mce_href="http://code.google.com/p/chromium/issues/detail?can=2&amp;amp;q=&amp;amp;colspec=ID%20Stars%20Pri%20Area%20Type%20Status%20Summary%20Modified%20Owner&amp;amp;sort=&amp;amp;id=650"&gt;http://code.google.com/p/chromium/issues/detail?can=2&amp;amp;q=&amp;amp;colspec=ID%20Stars%20Pri%20Area%20Type%20Status%20Summary%20Modified%20Owner&amp;amp;sort=&amp;amp;id=650&lt;/a&gt;, Look at the bottom, particularly this comment:&lt;pre&gt;The additional function wrapper was added in &lt;a href="http://weblogs.asp.net/p/chromium/source/detail?r=2111" mce_href="http://weblogs.asp.net/p/chromium/source/detail?r=2111"&gt;r2111&lt;/a&gt; &lt;br&gt;(http://src.chromium.org/viewvc/chrome?view=rev&amp;amp;revision=2111) and has been in Chrome &lt;br&gt;from version 0.2.153.0.&lt;/pre&gt;&lt;br&gt;From what I can see this is what is causing the issue, now who is at blame I cannot say but this is mighty anyoing :(, I knew this was working and for it to just&lt;br&gt;stop was painful and took some time to debug. But now that I know the issue it is time to tackle fixing it. There is a bit more that I have missed but it is late and I just got&lt;br&gt;down what I had for the moment. I will look into this more and keep you informed of what I come across.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Stay Tuned&lt;br&gt;Stefan &lt;/pre&gt;&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt; 

&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6719804" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="Javascript" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Javascript/default.aspx" /><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="Validation" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Validation/default.aspx" /></entry><entry><title>Extension Method Competition</title><link rel="alternate" type="text/html" href="http://weblogs.asp.net/stefansedich/archive/2008/10/22/extension-method-competition.aspx" /><id>http://weblogs.asp.net/stefansedich/archive/2008/10/22/extension-method-competition.aspx</id><published>2008-10-22T07:04:00Z</published><updated>2008-10-22T07:04:00Z</updated><content type="html">&lt;p&gt;I plan on holding an extension method competition, basically the idea is that you submit your favourite most useful/elegant/sexy extension method and these will be judged by a selection of judges (to be picked) and there will also be some form of reward for the winner.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;At this stage I am seeing if there will be interest in this, then I will then post up full and finalised details, so if you are interested and have any further suggestions please comment.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks&lt;br&gt;Stefan&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=6697512" width="1" height="1"&gt;</content><author><name>stefan.sedich</name><uri>http://weblogs.asp.net/members/stefan.sedich.aspx</uri></author><category term="ASP.NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/ASP.NET/default.aspx" /><category term=".NET" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET/default.aspx" /><category term=".NET 3.5" scheme="http://weblogs.asp.net/stefansedich/archive/tags/.NET+3.5/default.aspx" /><category term="C#" scheme="http://weblogs.asp.net/stefansedich/archive/tags/C_2300_/default.aspx" /><category term="Extension Methods" scheme="http://weblogs.asp.net/stefansedich/archive/tags/Extension+Methods/default.aspx" /></entry></feed>