NHibernate or Linq?

First of all I want to help you to choose between NHibernate and Linq. The answer is: it doesn't matter. Both have advantages but few disadvantages. The right choice depends on your feeling. Stick to the option which feels better for you. The reason for that is:



Linq is

  • part of .NET 3.5
  • integrated into Visual Studio
  • allows the usage of Linq and compile time error checking
  • slightly faster in reading, slightly slower in writing than NHibernate

But Linq is also

  • very new
  • generates entity classes for you. The control over your classes is limited. Although you can extend them with partial classes and inheritance. But you don't have that much control as if you're using NHibernate.

NHibernate is

  • mature with a great community in the .NET- and JAVA- world
  • very easy to use
  • database independent
  • lightweight. You can create the entity classes yourself and the mappings
  • slightly faster in saving, slightly slower in reading than Linq
  • HQL queries are supported with Linq (linq to nhibernate)

But NHibernate is also

  • a 3rd party library (which can be +)
  • not integrated into Visual Studio

 

Use ORM!


NHibernate is a mature open source project designed specifically to solve ORM problems. It is an extremely flexible and configurable ORM, and its been battle-proven for many enterprise projects. It is database agnostic, and supports a wide array of different database brands. Like many active open-source projects, it is undergoing constant evolution, which makes good documentation hard to find.


You should defeniteley use a ORM mapper to build your whole application and then, if you feel that certain features lack of performance you should only switch those critical parts of your applciations to stored procs. For instance you can tell NHibernate to call stored procs for certain queries.

That's my personal opinion and I am trying to convince colleagues of using ORM instead of stored procs all the time. It's a tough quest.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值