A typical use for Hash#merge is merging user supplied options with the default options for a particular action. Just now while doing this, I realized that the built-in merge method doesn’t merge nested hashes. First, let’s look at a trivial example use-case where you might need this.
Configuring FluentNHibernate with SQLite can be a bit painful, particularly because the SQLite assemblies are built separately for x86 and x64. On top of that, because NHibernate is loading the SQLite DLL at runtime, the DLL needs to be in a location that NHibernate can find it. When trying to set this up myself, I ran into the following error:
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection,
and InnerException for more details.
And the inner exception looked like this:
Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=184.108.40.20600, Culture=neutral,
Let’s talk about what this means and how we can solve it.
If you’ve worked with .NET 4, you might have run into this before. You’re casually typing and clicking along and then you go to add a reference to your project; but suddenly your application won’t build any more. The error complains about your targeted framework and a Microsoft library dependency. This library is included in .NET, but it won’t add to my project! What gives?
The referenced assembly "StructureMap" could not be resolved because it has a dependency on
"System.Web, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the
currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references
to assemblies not in the targeted framework or consider retargeting your project.
The DataGridView is incredibly helpful for binding data sources to a grid, but sometimes working with it is a bit tricky. If you use the DataGridView control sparingly (or you’re just plain forgetful), you might run into an issue where you can see rows in the grid, but all the cells are empty!