# 26 Haziran 2008 Perşembe
Kathleen Dollard wrote a response regarding the Vote of No Confidence on the Entity Framework. I was reading her post knowing that there will be lots of posts circling around the Vote of No Confidence, some will agree and some won't, and that was such a post from a particular point of view, until I hit this one (emphesis not mine):
"Entity approaches are good because they better separate the business and data sides of our middle tiers. But they are also inherently difficult and inaccessible to most programmers. Entity Framework’s goal must be to bridge this gap. That means being extremely creative in picking its battles to reach toward the real world developer – not copy a strategy that is available to that developer today and fails (the combination of NHibernate and other tools used in a specific style of development). The failure is not because NHibernate is an Open Source tool. It’s not because people don’t know about it. If it worked in the majority of shops it would burn through our industry like wildfire. Why don’t you use them? Because they do not fit your development environment!"
Sorry, but this is FUD or what? What's the ground here to say that NHibernate, or any O/RM approach mimicking it, is failing? Does Linq To SQL, which is no different in theory than NHibernate but lacks most of it's features, is a carrot from MS to the impatient while they wait for the uber EF framework? What makes something fail in MS land when it is actually quite successful in other platforms? Take TDD, for example. It works, appearently, and gaining some momentum. But it's nowhere near burning through our industry like wildfire. You can't make average Joe and his boss accept TDD as the defacto way of writing software. Does that mean TDD fails? Do we need some other über-TDD to replace it at the moment?

NHibernate does actually fit very well into my development environment, and I see no reason why it won't for any other developer. It has a clear SoC attitude, minimalistic configuration (compare NH xml configuration files with any behind-the-scene xml dialect from MS and you'll know what I mean), nice performance. It has everything if you want to write maintainable code. That does not mean that it's irreplaceable, but it just works, now, and any newcomer should challange it, not vice versa.

But yes, it does not fit the development environment often thought by Microsoft. Last year, I have paid a visit to a client who was suffering lots of performance, scalability and mainly maintainability problems with their in-house written ERP system. It turns out that, the application was built on typed datasets start to finish. They decided that they need to port their application to .Net, took some courses along with MOC 2541 (part of the official MS curriculum saying that data access is a solved problem if you use drag'n drop and datasets), realized that typed datasets is the ultimate-easy way do access data and the rest is history for them. Don't get me wrong, I instructed almost all the courses in the official MS curriculum, but in each case I mentioned and demoed alternatives and told the audience that what they see in the official book is just part of the story.

In the last couple years I'm feeling much better about Microsoft, the direction they're heading, the way they're interacting with and listening to the community. I'm also a firm believer in code generation when it's due, wrote some tools to make developers' life easier (including people using NHibernate), and actually paid a visit to Cambidge, UK to meet the nice people of the DSL Tools team for a job interview a couple of months ago (I failed, appearently). I'm buying the toy my son wanted by spending the money I earned by using Microsoft technologies, and I'm happy with what I do. But I can't stand the "MS way or nothing else" attitude.

Microsoft is famous for handling developers as babies sometimes. If you're a C# developer, create a VB.NET project and you'll see that behavior precisely. In a VB.Net project, why project references or .designer.cs files are hidden? Where all this namespace thing gone? Where's the damn entry point of this application? The broad, ignorant world of MS developer echosystem (of which I'm a part of) is actualy ignorant because of this simple fact. In the past, we are always told that there's a specific way of writing applications, and you can find tools and documentation from Microsoft if you want to know what it is. If there's a problem already solved, it's solved by Microsoft. It's comfortable to leave the thinking to someone else and do what you told.

But times are changing, DAL == DAAB no more, we are more open and influenced by other tools, platforms and thinking. This is also true for O/RM tools / frameworks. I visit lots of clients every week, and O/RM is really something people are researching or already using somehow, be it in-house, EF, Linq to SQL, LLBLGen, NHibernate, or something else. So, again, how can one say that NHibernate is done, kaput, arrivederci? It's all just started, and minds are shifting.

In the long-run, reaching real world developers only works if you solve their real world problems with long-lasting frameworks. And by long-lasting, I mean frameworks that survive rewrites, gives you the opportunity to say that "I was right by selecting this" three years after your first deployment. I'm not saying that EF is not one of them, but we have seen many palliative solutions from MS that didn't last long, and the items in that Vote of No Confidence document are real and learned by experience. Real world experience.

posted on 26 Haziran 2008 Perşembe 08:49:33 UTC  #   
# 14 Haziran 2007 Perşembe
Preview 3 has this functionality, but there are a few things to mention.

ActiveWriter use ActiveRecord assembly to generate NHibernate config files. So you'll need Castle.ActiveRecord.dll, NHibernate.dll and all necessary dependincies to make it work.



  1. Set the target to NHibernate
    This way, AW will generate .hbm.xml files for each entity in your model.
  2. Set the Assembly Path to where Castle.ActiveRecord.dll, NHibernate.dll and all necessary dependincies reside.
    The design decision was that, I didn't want to package these assemblies with AW. Rather than that, I thought user will most probably have them so they can choose whatever version they want to generate the configuration. If you don't supply the path, AW (VS, actually) will look for them in GAc and then {Your VS Path}\Common7\IDE\Castle.ActiveRecord.dll, so if you have them in one of those places, it should be fine.

    One other quirk is, if you first try to generate with the wrong path, setti ng the correct one later won't work until you restart Visual Studio. This is the framework's limitation, once you try to load an assembly and get an error, the result will be cached for subsequent tries. So VS appdomain should be restarted to make it work. I'll have a possible soliton for this for a future version of ActiveWriter (will try to load in a dummy appdomain, then in the VS appdomain)

    You may use the fully qualified assembly names for Active Record Assembly Name and NHibernate Assembly Name to target a specific version in the GAC, if you have more than one in there.
  3. When you save the model, AW will generate configuration.
I'll prepare a better documentation in the wiki.

Have fun.

Update:

AW does not work with release version of Castle assemblies (RC2?) for NHibernate generation, it works with the trunk (or with recently compiled assemblies). You can use the latest bits from the build server: http://builds.castleproject.org/cruise/index.castle
posted on 14 Haziran 2007 Perşembe 11:46:32 UTC  #