开发者

2010 Beginners guide to fluent nHibernate

I need some tutorials on how to get started with nHibernate and Fluent nHibernate. I'm coming from an Entity Framework background (which seems easier to use). I've tried sites like http://www.summerofnhibernate.com/ to get a grasp on nHibernate itself, but it seems outdated.

I'd like to generate a mapping of my database tables (al la Entity Framework), and do simple CRUD using nHibernate. I'm also using ASP.NET MVC and Visual stu开发者_运维百科dio 2010. Thanks.


Although a few years old, Summer of NHibernate concepts are pretty much intact and that's what it teaches you best. If you're a patient learner, start there.

On the side of Fluent NHibernate, the best tutorial is still the official one. The minor gripe it has is that it assumes that you're coming from an NHibernate raw background, so it's not particularly great explaining how to configure NHibernate (i.e. installing binaries for it and any given database). Edit: See Update at the bottom.

  • ASP.NET MVC: Although there are good tutorials for using NHibernate with ASP.NET MVC, every resource focuses on ASP.NET MVC and/or simply getting them to work together, assuming you already know it. But if you insist...
  • NHibernate books: NHibernate 3.0 Cookbook.

    1. NHibernate: a knol by Fabio Maulo
    2. Your first NHibernate based application
    3. Fluent NHibernate wiki


A bit more advanced resources:

  • NHibernate Profiler
  • S#arp Architecture: Best practices for ASP.NET and NHibernate.
  • Hibernate (based on the original, java-based Hibernate, but the concepts are still the same).
  • HQL: The Hibernate Query Language (I go here a lot).
  • LINQ for NHibernate examples.
  • Ayende @ Rahien: if you're on the NHibernate boat, you want to read whatever this guy writes.
  • NHibernate vs Entity Framework 4.0 - I think it's an advanced article because you won't understand it fully until you dabble with NHibernate, and if you have no clue about ORMs yet, you'll waste 5 minutes of your life.

Update: NHibernate can now be easily configured using NuGet.


Just like to suggest you to have a look at iBatis.Net (another open source ORM). iBatis in Java is already powerful and is finding place in all the large scale enterprise wide applications iBatis

iBatis in comparison to NHibernate differs in specifying the SQL queries. NHibernate generates all the SQL queries automatically where as in iBatis, you get to mention all the queries in XML files. This method scales very well and you don't need to recompile all the code when you need to change the SQL query. Just need to change the XML files. This is proving to be a maintenance delight for the enterprises. You can do more research and select which ORM to go for. But in my view iBatis.Net has a larger role to play.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜