<?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>Mindwhispers</title>
	<atom:link href="http://www.mindwhispers.be/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mindwhispers.be</link>
	<description>About this &#38; that and the usual life struggles</description>
	<lastBuildDate>Fri, 22 Jan 2010 13:59:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to fix WCF Error The remote server returned an unexpected response: (417) Expectation failed.</title>
		<link>http://www.mindwhispers.be/geekspeak/2010/01/19/how-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed/</link>
		<comments>http://www.mindwhispers.be/geekspeak/2010/01/19/how-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 10:42:44 +0000</pubDate>
		<dc:creator>Noctris</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Monkey]]></category>
		<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PFSense]]></category>
		<category><![CDATA[System Admin]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[3.5]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.mindwhispers.be/?p=208</guid>
		<description><![CDATA[Originally from: http://nahidulkibria.blogspot.com/2009/06/how-to-fix-wcf-error-remote-server.html

Few dayâ€™s ago one of our project(using wpf and wcf ) going live and we are start getting lots of weird error one of is 417 the remote server return unexpected response.
after some investigation and we found its only occur when client are behind a proxy in our case its squid(http://www.squid-cache.org/) and has [...]]]></description>
			<content:encoded><![CDATA[<p>Originally from: <a target="_blank" href="http://nahidulkibria.blogspot.com/2009/06/how-to-fix-wcf-error-remote-server.html">http://nahidulkibria.blogspot.com/2009/06/how-to-fix-wcf-error-remote-server.html</a><br />
<em><br />
Few dayâ€™s ago one of our project(using wpf and wcf ) going live and we are start getting lots of weird error one of is 417 the remote server return unexpected response.<br />
after some investigation and we found its only occur when client are behind a proxy in our case its squid(http://www.squid-cache.org/) and has a configuration like following in squid.conf</p>
<p>#This option makes Squid ignore any Expect: 100-continue header present<br />
#in the request. Note: Enabling this is a HTTP protocol violation, but some #client may not handle it well.. #Default:<br />
ignore_expect_100 off </p>
<p>we are solving this problem can be solved by changing squid configuration<br />
ignore_expect_100 on </p>
<p>the following settings on the app.config also solved the problem  </p>
<p><configuration><br />
<system.net><br />
<settings><br />
<servicePointManager expect100Continue="false" /><br />
</settings><br />
</system.net></p>
<p></configuration></p>
<p>but if you have control over your proxy server settings change that. if you do not have chance to change proxy settings and handle this with changing app.config may be facing problem upload large amount of file </p>
<p>for more information you can check this<br />
<a href="http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue.aspx">http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue.aspx</a></em></p>
<img src="http://www.mindwhispers.be/wp-content/plugins/pixelstats/trackingpixel.php?post_id=208&ts=1328703560" style="display:none;"/>


Share and Enjoy:


	<a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="Digg"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="Sphinn"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="del.icio.us"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;t=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="Facebook"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="Mixx"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F&amp;title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20" title="Google"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=How%20to%20fix%20WCF%20Error%20The%20remote%20server%20returned%20an%20unexpected%20response%3A%20%28417%29%20Expectation%20failed.%20&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F" title="Slashdot"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2010%2F01%2F19%2Fhow-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed%2F" title="Technorati"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mindwhispers.be/geekspeak/2010/01/19/how-to-fix-wcf-error-the-remote-server-returned-an-unexpected-response-417-expectation-failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browsing Folders on Samba server over VPN (IPSEC)</title>
		<link>http://www.mindwhispers.be/geekspeak/2009/09/08/browsing-folders-on-samba-server-over-vpn-ipsec/</link>
		<comments>http://www.mindwhispers.be/geekspeak/2009/09/08/browsing-folders-on-samba-server-over-vpn-ipsec/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 17:29:47 +0000</pubDate>
		<dc:creator>Noctris</dc:creator>
				<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Openfiler]]></category>
		<category><![CDATA[PFSense]]></category>
		<category><![CDATA[Connection Problems]]></category>
		<category><![CDATA[Fiber]]></category>
		<category><![CDATA[MTU]]></category>
		<category><![CDATA[Robocopy]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[xDSL]]></category>

		<guid isPermaLink="false">http://www.mindwhispers.be/?p=206</guid>
		<description><![CDATA[With our new fiber in place and a couple of extra configs done, it was time to make this our main connection and disconnect the old one&#8230; Thinkin this shoulud be a relativly straight forward &#8220;replug and play&#8221; operation, i went off yesterday switching the connection, adjusting ip&#8217;s in dns and the Vpn&#8217;s on our [...]]]></description>
			<content:encoded><![CDATA[<p>With our new fiber in place and a couple of extra configs done, it was time to make this our main connection and disconnect the old one&#8230; Thinkin this shoulud be a relativly straight forward &#8220;replug and play&#8221; operation, i went off yesterday switching the connection, adjusting ip&#8217;s in dns and the Vpn&#8217;s on our firewalls on both our office as the colo-location. Some pinging and tracerouting later , all seemed to be well&#8230;</p>
<p>However, early this morning, i started noticing issues with our nightly copy to the backup server in our co-location. Trying to browse servers on the other end gave me a strange issue:</p>
<p>when opening a server and/or share, this was ok as long as there where little files / folders in it. If they had more then about 10, it would fail with the info that &#8220;ERROR 65 the network location is no longer available&#8221;.. the made me embark on a quest which gave me some (strange) insights into the SMB Protocol.. first of, our setup might be important</p>
<p>Pfsense 1.2 firewalls everywhere both as main firewall as for our &#8220;routers&#8221;, ipsec between these towards our datacenter.<br />
OpenFiler boxes both in the main office as in our datacenter<br />
Simple Robocopy batches for copying the data.</p>
<p>after looking a lot at forums , i found several posts about PFsense not being able to handle fragmented packets over IPSEC. </p>
<p>Now after switching from xDSL to the fiber, I did not take a look further then the ip addresses of the firewall and for the IPSEC tunnels, however, what i did forget was that the <a href="http://en.wikipedia.org/wiki/Maximum_transmission_unit">MTU</a> for an xDSL line is 1492.. with our fiber, i did not know for sure.. </p>
<p>since PFSense by default takes MTU 1500 for any interface except for PPOE interfaces ( there is automatically sets it to 1492), i started to check some stuff and sure enough, i quickly found out using:</p>
<p>(on windows)</p>
<p>ping -f -l 1500 xxx.mydomain.com</p>
<p>that my packets would get fragmented.. </p>
<p>So looking further into it, i found out that MTU 1472 was the best i could find.. but helas.. no luck.. after some further searching i realized that altough my connection was able to handle 1472, IPSEC adds extra overhead data to your packets.. And sure enough, doing a </p>
<p>ping -f -l 1472 to one of my internal ip&#8217;s on the datacenter sides, resulted in fragmented packages yet again&#8230;</p>
<p>so another search for the best value we could use was done until i found out 1418 was the max MTU over my IPSEC Tunnel.. </p>
<p>after this, my samba shares where browseable like they should and the scripts could find the paths again</p>
<p>So kids, want to do Samba browsing over VPN (cause this does not only apply to IPSEC ?) Check your MTU..</p>
<p>Oh.. extra info: apparently (although this was not the case for us), Samba does NOT handle NAT :s</p>
<p>Think i&#8217;m going to send a mail to the guys over at Pfsense to see if it is possible to set an MTU for your ipsec tunnel only since now i&#8217;m operating below the MTU of my actual connection, just to be able to run samba stuff over it..</p>
<img src="http://www.mindwhispers.be/wp-content/plugins/pixelstats/trackingpixel.php?post_id=206&ts=1328703560" style="display:none;"/>


Share and Enjoy:


	<a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="Digg"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="Sphinn"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="del.icio.us"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;t=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="Facebook"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="Mixx"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F&amp;title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29" title="Google"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Browsing%20Folders%20on%20Samba%20server%20over%20VPN%20%28IPSEC%29&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F" title="Slashdot"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F09%2F08%2Fbrowsing-folders-on-samba-server-over-vpn-ipsec%2F" title="Technorati"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mindwhispers.be/geekspeak/2009/09/08/browsing-folders-on-samba-server-over-vpn-ipsec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started on Nhibernate</title>
		<link>http://www.mindwhispers.be/geekspeak/2009/07/02/getting-started-on-nhibernate/</link>
		<comments>http://www.mindwhispers.be/geekspeak/2009/07/02/getting-started-on-nhibernate/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 07:51:27 +0000</pubDate>
		<dc:creator>Noctris</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Monkey]]></category>
		<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[activemq]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[codesmith]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.mindwhispers.be/?p=203</guid>
		<description><![CDATA[A couple of weeks ago, i wrote about my evaluation of code generation tools. Now although i promised to update while doing so.. i didn&#8217;t .. the simple reason is:
I stopped it. After fideling around with several of them, i thought i was going to settle for codesmith.. Turns out that now, after a couple [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago, i wrote about my evaluation of code generation tools. Now although i promised to update while doing so.. i didn&#8217;t .. the simple reason is:</p>
<p>I stopped it. After fideling around with several of them, i thought i was going to settle for codesmith.. Turns out that now, after a couple of weeks of playing, the templates and &#8220;hacks&#8221; i&#8217;ve done are so extended that i only use codesmith for generating my object classes ( yes.. i&#8217;m a lazy man).. and that is about it !.</p>
<p>I did buy the product for this purposes and am still trying to do as much as i can with it.. I will update the article on my findings and why i bought codesmith but that is for later&#8230;</p>
<p>Because the biggest advantage i got from using codesmith is: I understand Nhibernate now. Now in the forums of <a href="http://www.hibernate.org">(N)hibernate</a> (<- site down AGAIN as we i write this.. come on guys, fix this please...) and <a href="http://nhforge.org">NHForge</a> i see a lot of posts about the steep learning curve of nhibernate. Now at first i agreeded.. Most of the docs were pretty abstract if you were not familiar with the naming of things.. So although i encountered this before, i have given up back then not having the time to do the learning at that point..</p>
<p>Now with codesmith, there is an nhibernate template provided. Even though, looking back now, this is not really &#8220;production ready&#8221; ( maybe if you are going to do a (little) website.. sure..). .And this template, for me anyway, took away the learning curve..</p>
<p>We use a sort of &#8220;agile&#8221; development method, meaning we do a lot of research about a technology/solution/architecture and once we are satisfied, we just start on it to see where it gets us. It was the same for Nhibernate and / or codesmith. And the only way we could do this, is the template.</p>
<p>After generating my DAL,it took me about a day to run into trouble. Having an &#8220;example&#8221;(aKa the template) ready, the structure and inner workings of Nhibernate became very clear to me wich gave me a fasttrack to Nhibernate.</p>
<p>Now, only a couple of weeks later, we have 2 services, a winforms app, a ASP.NET site and some other uttilities running Nhibernate with Message Queue (<a href="http://activemq.apache.org/">ActiveMQ</a>) middleware and MySQL database backend.. and although it is not working 100% yet, it&#8217;s looking fine.</p>
<p>We are using listeners for sending messages down to other applications for object inserts, updates and deletes, auditing on the tables for adding reccreated, reccreater, recmodified, recmodifier, recdeleted, recdeleter and several other things.. All of this thanks to the CodeSmith template giving us the start we needed to get going on Nhibernate&#8230;</p>
<img src="http://www.mindwhispers.be/wp-content/plugins/pixelstats/trackingpixel.php?post_id=203&ts=1328703560" style="display:none;"/>


Share and Enjoy:


	<a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;title=Getting%20started%20on%20Nhibernate" title="Digg"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;title=Getting%20started%20on%20Nhibernate" title="Sphinn"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;title=Getting%20started%20on%20Nhibernate" title="del.icio.us"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;t=Getting%20started%20on%20Nhibernate" title="Facebook"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;title=Getting%20started%20on%20Nhibernate" title="Mixx"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F&amp;title=Getting%20started%20on%20Nhibernate" title="Google"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Getting%20started%20on%20Nhibernate&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F" title="Slashdot"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F07%2F02%2Fgetting-started-on-nhibernate%2F" title="Technorati"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mindwhispers.be/geekspeak/2009/07/02/getting-started-on-nhibernate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nhibernate custom (logical) delete with delete flag</title>
		<link>http://www.mindwhispers.be/geekspeak/2009/05/28/nhibernate-custom-logical-delete-with-delete-flag/</link>
		<comments>http://www.mindwhispers.be/geekspeak/2009/05/28/nhibernate-custom-logical-delete-with-delete-flag/#comments</comments>
		<pubDate>Thu, 28 May 2009 15:20:33 +0000</pubDate>
		<dc:creator>Noctris</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code Monkey]]></category>
		<category><![CDATA[Geekspeak]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[custom delete]]></category>
		<category><![CDATA[delete flag]]></category>
		<category><![CDATA[hbm]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[nHibernate]]></category>

		<guid isPermaLink="false">http://www.mindwhispers.be/?p=190</guid>
		<description><![CDATA[Evey developer knows the disucssion who deleted a record and why or that they didn&#8217;t do it etc.; etc..
That is the reason why i NEVER do an actual delete of a record in the database but always use a flag ( reccreated, reccreater, recmodified,recmodifier,recdeleted,recdeleter and deleted as the flag)
Now since a while i&#8217;ve been looking [...]]]></description>
			<content:encoded><![CDATA[<p>Evey developer knows the disucssion who deleted a record and why or that they didn&#8217;t do it etc.; etc..</p>
<p>That is the reason why i NEVER do an actual delete of a record in the database but always use a flag ( reccreated, reccreater, recmodified,recmodifier,recdeleted,recdeleter and deleted as the flag)</p>
<p>Now since a while i&#8217;ve been looking at Nhibernate for O/R mapping and i like it a lot (read: it saved me TONS of time in combination with codesmith to do the generation)</p>
<p>However, the generated model of codesmith did not use any form of delete flag ( just normal CRUD) and looking for it, i found obscure ways of using triggers, stored procedures or Iinterceptor etc etc.. unfortunaly, using mysql, not all these options are possible AND , cause me a lot extra work.. but digging a bit deeper, i found a really easy way to do this using the Mapping files:</p>
<p>in your HBM maps, you can add a &#8220;where&#8221; clause which will cause Nhibernate to show only the records that match this clause ( in my case : where deleted = 0)</p>
<p>AND.. you can give it a custom sql command to do your delete:</p>
<p><sql -delete>update table set deleted = 1, recdeleted = now() where id = ?</sql></p>
<p>et voila !.. it&#8217;s that simple.. you do have to handle your relationships and/or bags but a relativly simple example looks like this:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
&lt;hibernate-mapping xmlns=&quot;urn:nhibernate-mapping-2.2&quot; namespace=&quot;TP2.mediabutler.Data.BusinessObjects&quot; assembly=&quot;TP2.mediabutler.Data&quot;&gt;
	&lt;class name=&quot;TP2.mediabutler.Data.BusinessObjects.Author, TP2.mediabutler.Data&quot; table=&quot;authors&quot; where=&quot;deleted = 0&quot; lazy=&quot;true&quot;&gt;
		&lt;id name=&quot;Id&quot; column=&quot;id&quot;&gt;
		 	&lt;generator class=&quot;assigned&quot; /&gt;
		&lt;/id&gt;
		&lt;property name=&quot;Name&quot; column=&quot;name&quot; /&gt;
		&lt;property name=&quot;Customerid&quot; column=&quot;customerid&quot; /&gt;
		&lt;property name=&quot;Reccreated&quot; column=&quot;reccreated&quot; /&gt;
		&lt;property name=&quot;Reccreater&quot; column=&quot;reccreater&quot; /&gt;
		&lt;property name=&quot;Recmodified&quot; column=&quot;recmodified&quot; /&gt;
		&lt;property name=&quot;Recmodifier&quot; column=&quot;recmodifier&quot; /&gt;
		&lt;property name=&quot;Recdeleted&quot; column=&quot;recdeleted&quot; /&gt;
		&lt;property name=&quot;Recdeleter&quot; column=&quot;recdeleter&quot; /&gt;
		&lt;property name=&quot;Deleted&quot; column=&quot;deleted&quot; /&gt;
		&lt;bag name=&quot;Libraries&quot; lazy=&quot;true&quot; cascade=&quot;all-delete-orphan&quot; inverse=&quot;true&quot; where=&quot;deleted = 0&quot; &gt;
			&lt;key column=&quot;author&quot;&gt;&lt;/key&gt;
			&lt;one-to-many class=&quot;Library&quot;&gt;&lt;/one-to-many&gt;
		&lt;/bag&gt;
		&lt;bag name=&quot;MediaMember&quot; lazy=&quot;true&quot; cascade=&quot;all-delete-orphan&quot; inverse=&quot;true&quot; where=&quot;deleted = 0&quot; &gt;
			&lt;key column=&quot;author&quot;&gt;&lt;/key&gt;
			&lt;one-to-many class=&quot;Media&quot;&gt;&lt;/one-to-many&gt;
		&lt;/bag&gt;
		&lt;sql-delete&gt;update authors set deleted = 1,recdeleted = now() where id = ?&lt;/sql-delete&gt;
	&lt;/class&gt;
&lt;/hibernate-mapping&gt;
</pre>
<p>and you are done !</p>
<p>for more information:</p>
<p><a href="http://nhforge.org/doc/nh/en/index.html#mapping-declaration-xmlns">http://nhforge.org/doc/nh/en/index.html#mapping-declaration-xmlns</a></p>
<img src="http://www.mindwhispers.be/wp-content/plugins/pixelstats/trackingpixel.php?post_id=190&ts=1328703560" style="display:none;"/>


Share and Enjoy:


	<a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="Digg"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="Sphinn"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="del.icio.us"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;t=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="Facebook"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="Mixx"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F&amp;title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag" title="Google"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Nhibernate%20custom%20%28logical%29%20delete%20with%20delete%20flag&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F" title="Slashdot"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mindwhispers.be%2Fgeekspeak%2F2009%2F05%2F28%2Fnhibernate-custom-logical-delete-with-delete-flag%2F" title="Technorati"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mindwhispers.be/geekspeak/2009/05/28/nhibernate-custom-logical-delete-with-delete-flag/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quote Of the Day</title>
		<link>http://www.mindwhispers.be/mindwhisper/2009/04/27/quote-of-the-day-4/</link>
		<comments>http://www.mindwhispers.be/mindwhisper/2009/04/27/quote-of-the-day-4/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:36:22 +0000</pubDate>
		<dc:creator>Noctris</dc:creator>
				<category><![CDATA[Fun fun fun]]></category>
		<category><![CDATA[Mindwhisper]]></category>
		<category><![CDATA[Quote of the day]]></category>

		<guid isPermaLink="false">http://www.mindwhispers.be/?p=183</guid>
		<description><![CDATA[An Optimist is a badly informed Pessimist 



Share and Enjoy:


	
	
	
	
	
	
	
	


]]></description>
			<content:encoded><![CDATA[<p>An Optimist is a badly informed Pessimist </p>
<img src="http://www.mindwhispers.be/wp-content/plugins/pixelstats/trackingpixel.php?post_id=183&ts=1328703560" style="display:none;"/>


Share and Enjoy:


	<a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;title=Quote%20Of%20the%20Day" title="Digg"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://sphinn.com/submit.php?url=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;title=Quote%20Of%20the%20Day" title="Sphinn"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/sphinn.gif" title="Sphinn" alt="Sphinn" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;title=Quote%20Of%20the%20Day" title="del.icio.us"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;t=Quote%20Of%20the%20Day" title="Facebook"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.mixx.com/submit?page_url=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;title=Quote%20Of%20the%20Day" title="Mixx"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/mixx.png" title="Mixx" alt="Mixx" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F&amp;title=Quote%20Of%20the%20Day" title="Google"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Quote%20Of%20the%20Day&amp;url=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F" title="Slashdot"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a>
	<a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.mindwhispers.be%2Fmindwhisper%2F2009%2F04%2F27%2Fquote-of-the-day-4%2F" title="Technorati"><img src="http://www.mindwhispers.be/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.mindwhispers.be/mindwhisper/2009/04/27/quote-of-the-day-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

