<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ryan Cromwell &#187; NHibernate</title>
	<atom:link href="http://blog.cromwellhaus.com/index.php/category/nhibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cromwellhaus.com</link>
	<description>Improving my craft...</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:06:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>NHibernate Thinks Your Enum is Dirty</title>
		<link>http://blog.cromwellhaus.com/2008/06/nhibernate-thinks-your-enum-is-dirty/</link>
		<comments>http://blog.cromwellhaus.com/2008/06/nhibernate-thinks-your-enum-is-dirty/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 17:18:20 +0000</pubDate>
		<dc:creator>cromwellryan</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">/blogs/ryanc/archive/2008/06/30/nhibernate-thinks-your-enum-is-dirty.aspx</guid>
		<description><![CDATA[Get your head out of the gutter. It&#8217;s important to look at your mapping files closely when trying to diagnose unexpected results.&#160; One of our developers had recently added two properties to our big honkin&#8217; CustomerOrder entity.&#160; These both happened to be enumeration values, which are represented by Int values in the database.&#160; Of course, [...]]]></description>
			<content:encoded><![CDATA[<p>Get your head out of the gutter.</p>
<p>It&#8217;s important to look at your mapping files closely when trying to diagnose unexpected results.&nbsp; One of our developers had recently added two properties to our big honkin&#8217; CustomerOrder entity.&nbsp; These both happened to be enumeration values, which are represented by Int values in the database.&nbsp; Of course, NHibernate mapping files (hbm&#8217;s) are from the POCO perspective, which means the &lt;property type=&#8221;&#8230;&#8221; /&gt;&nbsp; value should be the Enumeration&#8217;s themselves.&nbsp; If you use Int32, though, things will appear to work, but you&#8217;re actually causing NHibernate to do an incompatible type comparison during it&#8217;s &#8220;Dirty&#8221; checks.&nbsp; This will cause your lazily, loaded entities to be dirty as soon as you get them.</p>
<p>So, be careful in reviewing your mappings, because it doesn&#8217;t take much to screw up something small that has a big impact.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cromwellhaus.com/2008/06/nhibernate-thinks-your-enum-is-dirty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate Query Generator Installer for Visual Studio 2008</title>
		<link>http://blog.cromwellhaus.com/2007/12/nhibernate-query-generator-installer-for-visual-studio-2008/</link>
		<comments>http://blog.cromwellhaus.com/2007/12/nhibernate-query-generator-installer-for-visual-studio-2008/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 04:45:03 +0000</pubDate>
		<dc:creator>cromwellryan</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">/blogs/ryanc/archive/2007/12/07/nhibernate-query-generator-installer-for-visual-studio-2008.aspx</guid>
		<description><![CDATA[I posted recently a manual .reg file for adding the NHibernate Query Generator custom tool to Visual Studio 2008.&#160; I just sent Ayende an update to the .Setup Product.wxs, a WiX file, which adds a new fixture specifically for 2008.&#160; If you are interested in building the installer and running the trunk of NHQG, below [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cromwellhaus.com/blogphotos/NHibernateQueryGeneratorInstallerforVisu_14E01/image_3.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="235" alt="image" src="http://cromwellhaus.com/blogphotos/NHibernateQueryGeneratorInstallerforVisu_14E01/image_thumb_3.png" width="240" align="right" border="0"></a>I <a href="http://cromwellhaus.com/blogs/ryanc/archive/2007/11/19/nhibernate-query-generator-with-visual-studio-2008.aspx" target="_blank">posted recently</a> a manual .reg file for adding the NHibernate Query Generator custom tool to Visual Studio 2008.&nbsp; I just sent <a href="http://ayende.com/" target="_blank">Ayende</a> an update to the .Setup Product.wxs, a <a href="http://sourceforge.net/projects/wix/" target="_blank">WiX</a> file, which adds a new fixture specifically for 2008.&nbsp; </p>
<p>If you are interested in building the installer and running the trunk of NHQG, below is my batch script.&nbsp; Obviously, you&#8217;ll have to change a couple of paths, but it should get you started.&nbsp; </p>
<p>You can download the Product.wxs pending Ayende approving the new Product.wxs file <a href="http://cromwellhaus.com/files/folders/nh/entry438.aspx" target="_blank">here</a>.</p>
<blockquote><p><font face="Consolas">echo Off<br />set path=%path%;c:\tools\svn-win32-1.4.4\bin </font></p>
<p><font face="Consolas">echo get Trunk (Non-Recursive)&#8230;<br />svn co </font><a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk"><font face="Consolas">https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk</font></a><font face="Consolas"> trunk -q -N<br />echo done </font>
<p><font face="Consolas">echo get Art&#8230;<br />svn co </font><a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/Art"><font face="Consolas">https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/Art</font></a><font face="Consolas"> trunk/Art -q<br />echo done </font>
<p><font face="Consolas">echo get SharedLibs&#8230;<br />svn co </font><a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SharedLibs"><font face="Consolas">https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SharedLibs</font></a><font face="Consolas"> trunk/SharedLibs -q<br />echo done </font>
<p><font face="Consolas">echo get NHQG&#8230;<br />svn co </font><a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/NHibernate.Query.Generator"><font face="Consolas">https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/NHibernate.Query.Generator</font></a><font face="Consolas"> trunk/NHibernate.Query.Generator -q<br />echo done </font>
<p><font face="Consolas">echo build NHQG&#8230;<br />pushd .<br />cd trunk\NHibernate.Query.Generator<br />%windir%\Microsoft.NET\Framework64\v2.0.50727\msbuild.exe default.build <br />echo done </font>
<p><font face="Consolas">echo build Installer<br />cd NHibernate.Query.Generator.Setup<br />%windir%\Microsoft.NET\Framework\v2.0.50727\msbuild.exe Setup.wixproj <br />echo done<br />popd<br />PAUSE</font></p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.cromwellhaus.com/2007/12/nhibernate-query-generator-installer-for-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate Query Generator with Visual Studio 2008</title>
		<link>http://blog.cromwellhaus.com/2007/11/nhibernate-query-generator-with-visual-studio-2008/</link>
		<comments>http://blog.cromwellhaus.com/2007/11/nhibernate-query-generator-with-visual-studio-2008/#comments</comments>
		<pubDate>Mon, 19 Nov 2007 16:31:00 +0000</pubDate>
		<dc:creator>cromwellryan</dc:creator>
				<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">/blogs/ryanc/archive/2007/11/19/nhibernate-query-generator-with-visual-studio-2008.aspx</guid>
		<description><![CDATA[I&#8217;ve been using Ayende&#8217;s NHibernate Query Generator (NHQG) to help type-ify my NHibernate repository queries.&#160; One of the great +1&#8242;s of his tool is that you can apply it as a Custom Tool for your NHibernate mapping files right within Visual Studio.&#160;&#160; With this setup, every change to my mapping file is reflected in my [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cromwellhaus.com/blogs/ryanc/WindowsLiveWriter/NHibernateQueryGeneratorwithVisualStudio_9F3F/image_1.png" mce_href="http://cromwellhaus.com/blogs/ryanc/WindowsLiveWriter/NHibernateQueryGeneratorwithVisualStudio_9F3F/image_1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="202" alt="Custom Tool Configuration" src="http://cromwellhaus.com/blogs/ryanc/WindowsLiveWriter/NHibernateQueryGeneratorwithVisualStudio_9F3F/image_thumb_1.png" width="240" align="right" border="0" mce_src="http://cromwellhaus.com/blogs/ryanc/WindowsLiveWriter/NHibernateQueryGeneratorwithVisualStudio_9F3F/image_thumb_1.png"></a> I&#8217;ve been using <a href="http://www.ayende.com/Blog/" mce_href="http://www.ayende.com/Blog/">Ayende&#8217;s</a> <a href="http://ayende.com/projects/downloads/nhibernate-query-generator.aspx" mce_href="http://ayende.com/projects/downloads/nhibernate-query-generator.aspx">NHibernate Query Generator</a> (NHQG) to help type-ify my NHibernate repository queries.&nbsp; One of the great +1&#8242;s of his tool is that you can apply it as a <a href="http://msdn.microsoft.com/msdnmag/issues/02/10/NETTopTen/#S9" mce_href="http://msdn.microsoft.com/msdnmag/issues/02/10/NETTopTen/#S9">Custom Tool</a> for your NHibernate mapping files right within Visual Studio.&nbsp;&nbsp; </p>
<p>With this setup, every change to my mapping file is reflected in my typed NHibernate ICriteria instances.&nbsp; For those who work directly with Hibernate Expressions, look how clean my queries are:</p>
<blockquote><pre class="code"><span style="color: rgb(0,128,0)">// Get it using the Id</span><span style="color: rgb(0,0,255)">public</span> <span style="color: rgb(0,0,255)">static</span> <span style="color: rgb(43,145,175)">MyClass</span> GetById(<span style="color: rgb(0,0,255)">long</span> id){    <span style="color: rgb(0,0,255)">return</span> <span style="color: rgb(43,145,175)">Repository</span>.Get&lt;<span style="color: rgb(43,145,175)"><span style="color: rgb(43,145,175)">MyClass</span></span>&gt;(<span style="color: rgb(43,145,175)">Where</span>.MyClass.Id == id);}</pre>
<p><a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></a>
<pre class="code"><span style="color: rgb(0,128,0)">// Get those updated today</span><span style="color: rgb(0,0,255)">public</span> <span style="color: rgb(0,0,255)">void</span> Example2(){    <span style="color: rgb(43,145,175)">IList</span>&lt;<span style="color: rgb(43,145,175)"><span style="color: rgb(43,145,175)">MyClass</span></span>&gt; cards = <span style="color: rgb(43,145,175)">Repository</span>.Find&lt;<span style="color: rgb(43,145,175)"><span style="color: rgb(43,145,175)">MyClass</span></span>&gt;(<span style="color: rgb(43,145,175)">Where</span>.MyClass.LastUpdated &gt;= <span style="color: rgb(43,145,175)">DateTime</span>.Today);}</pre>
<p><a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></a></p></blockquote>
<p><a href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"></a></p>
<p>That&#8217;s just awesome!</p>
<p>There&#8217;s a slight glitch though, his installer only registers the tool for Visual Studio 2005.&nbsp; I&#8217;m sure now that 2008 is RTM (I&#8217;ve been using Beta 2) he&#8217;ll soon have a new version out, but in the mean time, you can use these two .reg files:</p>
<p><a href="http://cromwellhaus.com/files/folders/software/entry385.aspx" mce_href="http://cromwellhaus.com/files/folders/software/entry385.aspx">NHQG C# Custom Tool Registration</a></p>
<p><a href="http://cromwellhaus.com/files/folders/software/entry386.aspx" mce_href="http://cromwellhaus.com/files/folders/software/entry386.aspx">NHQG VB Custom Tool Registration</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cromwellhaus.com/2007/11/nhibernate-query-generator-with-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

