<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Rob Reynolds - The Fervent Coder : NHibernate</title><link>http://devlicio.us/blogs/rob_reynolds/archive/tags/NHibernate/default.aspx</link><description>Tags: NHibernate</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Refresh Database–Speed up Your Development Cycles</title><link>http://devlicio.us/blogs/rob_reynolds/archive/2012/12/12/refresh-database-speed-up-your-development-cycles.aspx</link><pubDate>Wed, 12 Dec 2012 22:40:42 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:70603</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/rsscomments.aspx?PostID=70603</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/commentapi.aspx?PostID=70603</wfw:comment><comments>http://devlicio.us/blogs/rob_reynolds/archive/2012/12/12/refresh-database-speed-up-your-development-cycles.aspx#comments</comments><description>&lt;p&gt;Refresh database is an workflow that allows you to develop with a migrations framework, but deploy with SQL files. It’s more than that, it allows you to rapidly make changes to your environment and sync up with other teammates. When I am talking about environment, I mean your local development environment: your code base and the local database back end you are hitting.&lt;/p&gt;  &lt;p&gt;Refresh database comes in two flavors, one for &lt;a href="http://nuget.org/packages/roundhouse.refreshdatabase.fnh"&gt;NHibernate&lt;/a&gt; and one for &lt;a href="http://nuget.org/packages/roundhouse.refreshdatabase.ef"&gt;Entity Framework&lt;/a&gt;. I’m going to show you an example of the one for Entity Framework, which you can find in the repository for &lt;a href="https://github.com/chucknorris/roundhouse-entityframework"&gt;rh-ef on github&lt;/a&gt;.&amp;#160; One note before we get started: This could work with any migrations framework that will output SQL files.&lt;/p&gt;  &lt;h4&gt;What is this? Why should I use this?&lt;/h4&gt;  &lt;p&gt;How long do you spend updating source code and then getting your database up to snuff afterward so you can keep moving forward quickly? Do you work with teammates? Do you have multiple workstations that you might work from and want to quickly sync up your work?&lt;/p&gt;  &lt;p&gt;It’s a pain most of us don’t see and an idea that was originally incubated by &lt;a href="https://twitter.com/drusellers"&gt;Dru Sellers&lt;/a&gt;. He wanted a fast way of keeping his local stuff up to date right from Visual Studio. Out of that was born Refresh Database. We are talking a simple right click and debug to a synced up database.&lt;/p&gt;  &lt;p&gt;Others have talked in the past about how you want to use the same migration algorithm and test it all the way up to production. Refresh DB allows you to test that migration from a local development environment many times a day. So by the time you hand over the SQL files for production (or use RoundhousE), there is no guess work about whether it is going to work or not. You have a security in knowing that you are good to go.&lt;/p&gt;  &lt;p&gt;It’s definitely something that can really speed up your team so you never hear “I got latest and now I’m trying to sync up all the changes to the database.” This should be easy. This should be automatic.&lt;/p&gt;  &lt;p&gt;You should never again hear “I made some domain changes but now I’m working to get them into the database.” This should be easy. This should be automatic. &lt;/p&gt;  &lt;p&gt;Whether you decide to look further into this or not, it doesn’t matter to me. It just means my teams will get to market and keep updated faster than you (given the same technologies, &lt;img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style:none;border-left-style:none;border-bottom-style:none;border-right-style:none;" alt="Winking smile" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/wlEmoticon_2D00_winkingsmile_5F00_378BAF41.png" /&gt;).&lt;/p&gt;  &lt;h4&gt;How does this work?&lt;/h4&gt;  &lt;p&gt;This is the simple part. Convincing you to look at it in the first place is the hard part. I have put together a short video to show you exactly how it works. You will see that it is super simple.&lt;/p&gt;  &lt;div id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:292d3927-2806-4559-855b-4a47530f9b96" class="wlWriterEditableSmartContent" style="float:none;padding-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;display:inline;padding-right:0px;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=-YAPPsT-pOA" target="_new"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/video314400f224bc_5F00_1830A0BD.jpg" style="border-style:none;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;  &lt;h4&gt;Conclusion&lt;/h4&gt;  &lt;p&gt;Refresh Database has been around for over two years. It’s definitely something that has paid for itself time and again. It’s something you might consider looking at it if you have never heard of it. &lt;/p&gt;  &lt;p&gt;If you don’t do something with migrations and source control for your database yet, please start now. This will save you countless hours in the future. I’ve walked into more than one company that was hurting in the area of database development b/c they didn’t treat the database scripts as source code in the same way that they did the rest of the code. It’s a must anymore. I also see teams doing shared development database development. This is a huge no no (except in certain considerations) due to the amount of lost time it causes. That however, is a discussion for another day.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=70603" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Fluent+NHibernate/default.aspx">Fluent NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/RoundhousE/default.aspx">RoundhousE</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/EntityFramework/default.aspx">EntityFramework</category></item><item><title>AppHarbor - Azure Done Right AKA Heroku for .NET</title><link>http://devlicio.us/blogs/rob_reynolds/archive/2011/02/16/appharbor-azure-done-right-aka-heroku-for-net.aspx</link><pubDate>Wed, 16 Feb 2011 12:49:23 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:66401</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/rsscomments.aspx?PostID=66401</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/commentapi.aspx?PostID=66401</wfw:comment><comments>http://devlicio.us/blogs/rob_reynolds/archive/2011/02/16/appharbor-azure-done-right-aka-heroku-for-net.aspx#comments</comments><description>&lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Easy and Instant deployments and instant scale for .NET?&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Awhile back a &lt;a href="http://groups.google.com/group/nu-net" target="_blank"&gt;few of us&lt;/a&gt; were looking at &lt;a href="http://rubygems.org/" target="_blank"&gt;Ruby Gems&lt;/a&gt; as the answer to &lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/15/gems-package-management-for-net.aspx" target="_blank"&gt;package management for .NET&lt;/a&gt;. The gems platform supported the concept of DLLs as packages although some changes would have needed to happen to have long term use for the entire community. From that we formed a partnership with some folks at Microsoft to make v2 into something that would meet &lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/10/06/the-evolution-of-package-management-for-net.aspx" target="_blank"&gt;wider adoption across the community&lt;/a&gt;, which people now call &lt;a href="http://nuget.codeplex.com/" target="_blank"&gt;NuGet&lt;/a&gt;. So now we have the concept of package management. What comes next?&lt;/p&gt;  &lt;h4&gt;&lt;u&gt;Heroku&lt;/u&gt;&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;Instant deployments and instant scaling. Stupid simple API.&lt;/strong&gt; This is &lt;a href="http://heroku.com/" target="_blank"&gt;Heroku&lt;/a&gt;. It doesn’t sound like much, but when you think of how fast you can go from an idea to having someone else tinker with it, you can start to see its power. In literally seconds you can be looking at your rails application deployed and online. Then when you are ready to scale, you can do that. This is power. Some may call this “cloud-computing” or &lt;a href="http://en.wikipedia.org/wiki/Platform_as_a_service" target="_blank"&gt;PaaS&lt;/a&gt; (Platform as a Service).&lt;/p&gt;  &lt;p&gt;I first ran into Heroku back in July when I met &lt;a href="http://litanyagainstfear.com/" target="_blank"&gt;Nick&lt;/a&gt; of &lt;a href="http://rubygems.org/" target="_blank"&gt;RubyGems.org&lt;/a&gt;. At the time there was no alternative in the .NET-o-sphere. I don’t count &lt;a href="http://www.microsoft.com/windowsazure/" target="_blank"&gt;Windows Azure&lt;/a&gt;, mostly because it is not simple and I don’t believe there is a free version. Heroku itself would not lend itself well to .NET due to the nature of platforms and each language’s specific needs (solution stack).&amp;#160; So I tucked the idea in the back of my head and moved on. &lt;/p&gt;  &lt;h4&gt;&lt;u&gt;AppHarbor Enters The Scene&lt;/u&gt;&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_14CF6EF3.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;float:right;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" align="right" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_7D54BAC1.png" width="244" height="184" /&gt;&lt;/a&gt;I’m not sure when I first heard about &lt;a href="http://appharbor.com/" target="_blank"&gt;AppHarbor&lt;/a&gt; as a possible .NET version of Heroku. It may have been in November, but I didn’t actually try it until January. I was instantly hooked. AppHarbor is awesome! It still has a ways to go to be considered Heroku for .NET, but it already has a growing community. I created a video series (at the bottom of this post) that really highlights how fast you can get a product onto the web and really shows the power and simplicity of AppHarbor. &lt;/p&gt;  &lt;p&gt;Deploying is as simple as a git/hg push to appharbor. From there they build your code, run any unit tests you have and deploy it if everything succeeds. The screen on the right shows a simple and elegant UI to getting things done.&lt;/p&gt;  &lt;p&gt;The folks at AppHarbor graciously gave me a limited number of invites to hand out. If you are itching to try AppHarbor then navigate to: &lt;a title="new-inviteCode=ferventcoder" href="https://appharbor.com/account/new?inviteCode=ferventcoder"&gt;https://appharbor.com/account/new?inviteCode=ferventcoder&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;After playing with it, send &lt;a href="http://feedback.appharbor.com/forums/95687-general"&gt;feedback&lt;/a&gt; if you want more features. Go vote up &lt;a href="http://feedback.appharbor.com/forums/95687-general/suggestions/1380047-gem-command-line-application?ref=title"&gt;two&lt;/a&gt; &lt;a href="http://feedback.appharbor.com/forums/95687-general/suggestions/1377701-migrations?ref=title"&gt;features&lt;/a&gt; I want that will make it more like Heroku.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Disclaimer: I am in no way affiliated with AppHarbor and have not received any funds or favors from anyone at AppHarbor. I just think it is awesome and I want others to know about it.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;&lt;u&gt;From Zero To Deployed in 15 Minutes (Or Less)&lt;/u&gt;&lt;/h4&gt;  &lt;p&gt;Now I have a challenge for you. I created a video series showing how fast I could go from nothing to a deployed application. It could have been from Zero to Deployed in Less than 5 minutes, but I wanted to show you the tools a little more and give you an opportunity to beat my time.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;And that’s the challenge. Beat my time and show it in a video response.&lt;/strong&gt; The video series is below (at least one of the videos has to be watched on YouTube). The person with the best time by March 15th @ 11:59PM CST will receive a prize.&lt;/p&gt;  &lt;p&gt;Ground rules: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;.NET Application with a valid database connection &lt;/li&gt;    &lt;li&gt;Start from Zero &lt;/li&gt;    &lt;li&gt;Deployed with AppHarbor or an alternative &lt;/li&gt;    &lt;li&gt;A timer displayed in the video that runs during the entire process &lt;/li&gt;    &lt;li&gt;Video response published on YouTube or acceptable alternative &lt;/li&gt;    &lt;li&gt;Video(s) must be published by March 15th at 11:59PM CST.&lt;/li&gt;    &lt;li&gt;Either post the link here as a comment or on YouTube as a response (also by 11:59PM CST March 15th)&lt;/li&gt; &lt;/ul&gt;    &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:e1a3d5a5-c97b-4a35-911e-8b2163418dc8" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=cZIUVfHWsbc" target="_new"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/video454d0754bef1_5F00_566840DC.jpg" style="border-style:none;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="width:448px;clear:both;font-size:.8em;"&gt;From Zero To Deployed In 15 Minutes (Or Less) Part 1&lt;/div&gt;&lt;/div&gt;      &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:9bf5acc4-7735-4b63-a773-6448d28ba476" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=l7WluaXIya0" target="_new"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/videoffb63c9cfc3e_5F00_1BA09806.jpg" style="border-style:none;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="width:448px;clear:both;font-size:.8em;"&gt;From Zero To Deployed In 15 Minutes (Or Less) Part 2&lt;/div&gt;&lt;/div&gt;      &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:18da1711-02ee-4953-ba19-2ce35e8f4bf5" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=IqPh7wbWsLc" target="_new"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/video8c3ef0b1b950_5F00_5306A934.jpg" style="border-style:none;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="width:448px;clear:both;font-size:.8em;"&gt;From Zero To Deployed In 15 Minutes (Or Less) Part 3&lt;/div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=66401" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Fluent+NHibernate/default.aspx">Fluent NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/RoundhousE/default.aspx">RoundhousE</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/UppercuT/default.aspx">UppercuT</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Git/default.aspx">Git</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Gems/default.aspx">Gems</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Challenge/default.aspx">Challenge</category></item><item><title>The Future of .NET Open Source Software Delivery</title><link>http://devlicio.us/blogs/rob_reynolds/archive/2010/07/26/the-future-of-net-open-source-software-delivery.aspx</link><pubDate>Mon, 26 Jul 2010 18:57:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:61235</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/rsscomments.aspx?PostID=61235</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/commentapi.aspx?PostID=61235</wfw:comment><comments>http://devlicio.us/blogs/rob_reynolds/archive/2010/07/26/the-future-of-net-open-source-software-delivery.aspx#comments</comments><description>&lt;p&gt;Imagine we are awhile into the future. How do you get open source releases down to your project so that you can use them? How do you get the products down to your computer so that you can use them? Is it easier or harder than the way we’ve always done it before?&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;The Past and Present&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;Before we can go there, let’s look at what we do now (the past is really the same for us here). Let’s say I want to use &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt;. What do I do?&amp;#160; There are basically three paths we all follow in this process.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1. Never had product x before.&lt;/strong&gt; If I don’t have a current version, I have to go out and look for it. So what do I do? &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Open a browser &lt;/li&gt;    &lt;li&gt;Find the site &lt;/li&gt;    &lt;li&gt;Find the downloads &lt;/li&gt;    &lt;li&gt;Find the particular download I want through the plethora of options that may be presented to me &lt;/li&gt;    &lt;li&gt;Download it &lt;/li&gt;    &lt;li&gt;Unzip it &lt;/li&gt;    &lt;li&gt;Then put it into my project references folder somewhere so I can keep it in source control with my project &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;2. Use the current version without upgrade.&lt;/strong&gt; If I have a current version, I may just copy it over and use it in my new project. Nevermind that it is two versions ago. I don’t want to take the time to upgrade because it could be a pain.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Open file explorer and find the project with the old version &lt;/li&gt;    &lt;li&gt;Open file explorer and find the new project &lt;/li&gt;    &lt;li&gt;Create the structure I need for the references folder &lt;/li&gt;    &lt;li&gt;Copy the contents of the old project to the new project &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;3. Upgrade.&lt;/strong&gt; If I find a bug or I decide it’s time to upgrade to a newer version, how do I get it? Repeat the process of #&lt;strong&gt;1 (Never had product x before)&lt;/strong&gt; and getting the latest version. &lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;Problems with the Present Method of Delivery&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;It&amp;#39;s slow.&lt;/strong&gt; How long did it take me to get all of that? Yeah, now multiply times every library I want to use.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Too many decisions.&lt;/strong&gt; I have to make way to many decisions to get the right product and right version downloaded and referenced into my project.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Dependencies may be hard to manage.&lt;/strong&gt; I may be using projects that depend on the same libraries. In the example above I am using &lt;a href="http://castleproject.org" target="_blank"&gt;Castle &lt;/a&gt;in my project. That got upgraded as well when I got the latest version of NHibernate. Now I may have to test the changes to that. What if the latest version of Castle Windsor I am using is not compatible with the latest version of NHibernate? I won’t see that issue necessarily until I try to run my code. I can try &lt;a href="http://ferventcoder.com/archive/2009/07/19/net-binding-redirects-ndash-updating-referenced-assemblies-without-recompiling-code.aspx" target="_blank"&gt;binding redirects&lt;/a&gt;, but there is no guarantee that that will work. So now I have a problem. I have to figure out what version of Castle Windsor to use so that I can use the latest version of NHibernate. And this is where dependency management is fully placed on me as a developer. I can now decide to move forward or just continue to use the old version.&lt;/p&gt;  &lt;div&gt;&lt;strong&gt;Too easy to just continue using the same version you have.&lt;/strong&gt; It&amp;#39;s way too easy to keep using the version you first downloaded and never learning about all of the awesomeness that comes with more current versions of the product.&lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;div&gt;Unfortunately for a lot of people, what I just mentioned with projects that have dependencies on the same things as other projects is the biggest barrier to using OSS (Open Source Software). So let’s talk about the future.&lt;/div&gt;  &lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;The Future&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;So now that we have looked at how we currently do it, how will it be in the future?&lt;/p&gt;  &lt;p&gt;Open source developers will publish their latest releases to a central repository (possibly in addition to other methods of offering releases).&amp;#160; Then everyone can get their latest releases and develop from there.&lt;/p&gt;  &lt;p&gt;Same three scenarios.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1. Never had product x before.&lt;/strong&gt; Here’s the process.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Know what I’m looking for and confirm the name at the central repository &lt;/li&gt;    &lt;li&gt;open a command line &lt;/li&gt;    &lt;li&gt;type something to the effect of &lt;strong&gt;nu install nhibernate&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And I’m done. It’s all brought to me and sitting in my references folder of my project.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;2. Use the current version without upgrade.&lt;/strong&gt; This is still an option. Same as in the present described above.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;3. Upgrade.&lt;/strong&gt; Here’s the process.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;open a command line &lt;/li&gt;    &lt;li&gt;type something to the effect of &lt;strong&gt;gem update&lt;/strong&gt; &lt;/li&gt;    &lt;li&gt;type something to the effect of &lt;strong&gt;nu install nhibernate&lt;/strong&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;What Issues Does the Future Method of Delivery Address?&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;Speed.&lt;/strong&gt; The process is amazingly streamlined. We are talking seconds as compared to minutes of time to get something. I can now concentrate on what I want to do instead of spending all the time I was on just getting the packages I needed.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The decision tree is reduced.&lt;/strong&gt; How many decisions did I have to make to get what I needed in the present scenario? How about the future scenario? Greatly reduced.&amp;#160; Less choices to get what I want actually gets me to a decision faster.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;I immediately see the dependency changes.&lt;/strong&gt; All of the dependencies that are required come along nicely with NHibernate. I can immediately see that it downgraded my versions of Castle Core and Dynamic Proxy2. So now I know immediately that I have a problem between Castle Windsor and NHibernate using different versions. It doesn’t solve my problems on this, but it brings it to the surface. So now I can try something like the aforementioned binding redirects.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The process of upgrade became easier than use the current.&lt;/strong&gt; Another thing you may have noticed. It actually becomes easier to upgrade to the latest version as compared to #2 (&lt;strong&gt;Use the current version&lt;/strong&gt;). That will move people to upgrade, because people will choose the easiest path to get them on their way. And when everyone using the latest version, everyone wins.&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;The Future Is Now&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;Oh yeah, the future? It’s now. &lt;a href="http://groups.google.com/group/nu-net" target="_blank"&gt;http://groups.google.com/group/nu-net&lt;/a&gt; &lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:b1315f18-80af-46cc-893e-c98d9108f752" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=IvxAa4XURss" target="_new"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/video8a32a384f044_5F00_19915CAC.jpg" style="border-style:none;" alt="" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Related Posts&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;Before you comment about “cluttering” the ruby community, please be sure to read this (we’re with you on this):&amp;#160; &lt;a title="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/19/gems-for-net-community-response.aspx" href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/19/gems-for-net-community-response.aspx" target="_blank"&gt;http://devlicio.us/blogs/rob_reynolds/archive/2010/07/19/gems-for-net-community-response.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/15/gems-package-management-for-net.aspx" target="_blank"&gt;Gems - Package Management for .NET&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/16/how-to-gems-and-net.aspx" target="_blank"&gt;How To – Gems &amp;amp; .NET&lt;/a&gt; &amp;amp; &lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/17/how-to-gems-and-net-dependencies-references.aspx" target="_blank"&gt;How To – Gems &amp;amp; .NET - Dependencies (References)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/20/how-to-uppercut-and-gems.aspx"&gt;Walkthrough - Create Gems Even Easier With a Conventional Build (UppercuT)!&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=61235" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/RoundhousE/default.aspx">RoundhousE</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/UppercuT/default.aspx">UppercuT</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Gems/default.aspx">Gems</category></item><item><title>NHibernate Event Listener Registration With Fluent NHibernate</title><link>http://devlicio.us/blogs/rob_reynolds/archive/2009/11/20/nhibernate-event-listener-registration-with-fluent-nhibernate.aspx</link><pubDate>Sat, 21 Nov 2009 04:38:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:53860</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/rsscomments.aspx?PostID=53860</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/rob_reynolds/commentapi.aspx?PostID=53860</wfw:comment><comments>http://devlicio.us/blogs/rob_reynolds/archive/2009/11/20/nhibernate-event-listener-registration-with-fluent-nhibernate.aspx#comments</comments><description>&lt;p&gt;I’m a huge fan of &lt;a href="https://www.hibernate.org/343.html" target="_blank"&gt;NHibernate&lt;/a&gt;. It has excellent &lt;a href="http://nhforge.org/Default.aspx" target="_blank"&gt;documentation&lt;/a&gt; and just makes the whole job of getting things into and out of the database much more enjoyable.&amp;#160; There is a whole series of posts on &lt;a href="http://ayende.com/Blog/category/510.aspx" target="_blank"&gt;NHibernate&lt;/a&gt; from one of the committers, &lt;a href="http://ayende.com/Blog/" target="_blank"&gt;Ayende&lt;/a&gt;.&amp;#160; When &lt;a href="http://fluentnhibernate.org/" target="_blank"&gt;Fluent NHibernate&lt;/a&gt; (FNH) came out, it was like butter on sliced bread.&amp;#160; FNH makes it even easier to use NHibernate. &lt;/p&gt;  &lt;p&gt;Ayende had a great &lt;a href="http://ayende.com/Blog/archive/2009/04/29/nhibernate-ipreupdateeventlistener-amp-ipreinserteventlistener.aspx" target="_blank"&gt;post&lt;/a&gt; a while back on how to use Event Listeners. What does an Event Listener do, and furthermore, what does it look like? Listeners give you really low level access to an object just before it gets saved into the database. That allows you at this point to get to both the old state and the new state of an object. You can at this point do any auditing you need to do on the insert, update or delete. I believe you could even block the changes if necessary, but I would probably do that at a higher level before reaching this point.&amp;#160; One of the best uses for listeners is the one presented below, where you can modify the fields for an insert date, a modified date, and the modifying user. &lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Event Listeners&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;pre class="c#" name="code"&gt;namespace projectname.infrastructure.app.auditing
{
    using System;
    using System.Security.Principal;
    using System.Web;
    using domain;
    using NHibernate.Event;
    using NHibernate.Persister.Entity;

    public class AuditEventListener : IPreInsertEventListener, IPreUpdateEventListener
    {
        public string get_identity()
        {
            return WindowsIdentity.GetCurrent().Name;
        }

        public bool OnPreInsert(PreInsertEvent event_item)
        {
            Auditable audit = event_item.Entity as Auditable;
            if (audit == null)
            {
                return false;
            }

            DateTime? entered_date = DateTime.Now;
            DateTime? modified_date = DateTime.Now;
            string identity_of_updater = get_identity();

            store(event_item.Persister, event_item.State, &amp;quot;entered_date&amp;quot;, entered_date);
            store(event_item.Persister, event_item.State, &amp;quot;modified_date&amp;quot;, modified_date);
            store(event_item.Persister, event_item.State, &amp;quot;updating_user&amp;quot;, identity_of_updater);
            audit.entered_date = entered_date;
            audit.modified_date = modified_date;
            audit.updating_user = identity_of_updater;

            return false;
        }

        public bool OnPreUpdate(PreUpdateEvent event_item)
        {
            Auditable audit = event_item.Entity as Auditable;
            if (audit == null)
            {
                return false;
            }

            DateTime? modified_date = DateTime.Now;
            string identity_of_updater = get_identity();

            store(event_item.Persister, event_item.State, &amp;quot;modified_date&amp;quot;, modified_date);
            store(event_item.Persister, event_item.State, &amp;quot;updating_user&amp;quot;, identity_of_updater);
            audit.modified_date = modified_date;
            audit.updating_user = identity_of_updater;

            //insert auditing object here

            return false;
        }

        public void store(IEntityPersister persister, object[] state, string property_name, object value)
        {
            int index = Array.IndexOf(persister.PropertyNames, property_name);
            if (index == -1)
            {
                return;
            }
            state[index] = value;
        }
    }
}&lt;/pre&gt;

&lt;p&gt;Notice I had to update each value twice. Once on the item and once in the new state. I believe (and I could be wrong) that we update the state so it gets saved to the database and we update the object to match the state of the database so we are in sync. It&amp;#39;s a small price to pay for getting this low level access.&lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Great! Now I have my listeners, but if I run it now, this never gets called. That’s because I haven’t told NHibernate about these event listeners. So I go searching some on the interwebs to learn how to register the listeners. And I come across &lt;a href="http://ayende.com/Blog/archive/2009/06/11/nhibernate-ndash-automatic-change-tracking-for-aggregate-roots-in-ddd.aspx" target="_blank"&gt;this&lt;/a&gt;. Ayende talks about how to registration in the configuration file in a later post, but with FNH, I register in code.&amp;#160; Hmmm… back to the interwebs… &lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Then I came across Adam Aldrich’s &lt;a href="http://guildsocial.web703.discountasp.net/dasblogce/2009/06/02/IPreUpdateEventListenerRegistration.aspx" target="_blank"&gt;post&lt;/a&gt; on how to register the listeners in code. This is from his post on &lt;a href="http://guildsocial.web703.discountasp.net/dasblogce/2009/06/02/IPreUpdateEventListenerRegistration.aspx" target="_blank"&gt;registration&lt;/a&gt;:&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.EventListeners.PreUpdateEventListeners = 
  new IPreUpdateEventListener[] { new AuditEventListener() };
cfg.EventListeners.PreInsertEventListeners = 
  new IPreInsertEventListener[] { new AuditEventListener() };
_sessionFactory = cfg.BuildSessionFactory();&lt;/pre&gt;

&lt;p&gt;This is just what I was looking for! Code-based registration. But how do I use FNH to set that up?&amp;#160; That’s where some nice detective work and a fluent interface come in.&lt;/p&gt;

&lt;h4&gt;&lt;strong&gt;&lt;u&gt;Fluent NHibernate Registration of Event Listeners&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;pre class="c#" name="code"&gt;private void build_factory()
{
    if (nhibernate_session_factory == null)
    {
        nhibernate_session_factory = Fluently.Configure()
            .Database(MsSqlConfiguration.MsSql2005
                .ConnectionString(c =&amp;gt; 
                    c.FromConnectionStringWithKey(&amp;quot;db&amp;quot;)))
            .Mappings(m =&amp;gt; 
                m.FluentMappings.AddFromAssemblyOf&amp;lt;VideoMapping&amp;gt;())
            .ExposeConfiguration(cfg =&amp;gt; {
                cfg.SetListener(ListenerType.PreInsert, 
                    new AuditEventListener());
                cfg.SetListener(ListenerType.PreUpdate, 
                    new AuditEventListener());
                })
            .BuildSessionFactory();
    }
}&lt;/pre&gt;

&lt;p&gt;What FNH has given me here is a way back to the configuration. Now I have full access to do anything I need to do with NHibernate. With it’s discoverability, FNH makes it a joy to use and makes NHibernate even more awesome! &lt;/p&gt;

&lt;p&gt;
  &lt;br /&gt;Dear reader, what libraries do you find a joy to use? And why?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=53860" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Fluent+NHibernate/default.aspx">Fluent NHibernate</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/HowTo/default.aspx">HowTo</category></item></channel></rss>