EEE
EEE

Reputation: 4536

Which is the best for a 3-tier architecture; Linq to SQL or Nhibernate?

Which is the best solution for 3-tier arch. Linq to SQL or Nhibernate? Specifically, I will upgrade a system in 2-tier architecture to 3-tier architecture?

Edit: And where can I find good tutorials or videos for both?

Upvotes: 2

Views: 1440

Answers (6)

Aaron Fischer
Aaron Fischer

Reputation: 21231

what is the best solution for 3tier, I would say neither. There is no cookie cutter response every framework/library you choose will have trade-offs. To make this ORM decision you need to look at your business needs and determine which of the many possibilities will best help you achieve our goals in a timely and maintainable way. How complex is your domain model and can linq to sql adequately describe them.

Upvotes: 1

Wayne Molina
Wayne Molina

Reputation: 19626

I would say go with LINQ to SQL if your application needs only basic functionality, otherwise use NHibernate. I know a smattering of LINQ and I'm looking at learning NHibernate, and from what I can tell NHibernate is a better longterm solution since it's more abstract than L2S (which is pretty tightly coupled to the database), but L2S is easier to pick up and provides a quicker solution.

Without knowing more about your specific problem, I would say use NHibernate as it's more flexible and respondent to change, although with a slightly more "enterprise" learning curve than Linq to Sql. For a good NHibernate resource I recommend checking out Steve Bohlen's "Summer of NHibernate" series.

Upvotes: 1

IrishChieftain
IrishChieftain

Reputation: 15252

I haven't used Nhibernate but I do know that Microsoft has confirmed that while it will support LINQ to SQL going forward, there will be no more development done by them on that particular technology.

Upvotes: 0

duffymo
duffymo

Reputation: 309008

I don't know if it's equally true for .NET, but if I were solving this problem with Java and Spring I'd start with an interface that would hide the implementation choice. Clients need not be aware of whether it's LINQ or NHibernate doing the work. Spring would allow me to inject one implementation or the other at will, without disturbing clients, as long as both implemented the agreed-upon interface.

Upvotes: 1

Wim
Wim

Reputation: 12092

If you're only ever need to support one DB platform and have your database model already, LINQ-to-SQL makes sense.

However, you could also use FluentNHibernate to generate the mappings for you.

If support for multiple DB's and granular and flexible control over mappings is important, go NHibernate. Else, LINQ-to-SQL will do fine. Avoid LINQ-to-Entities like the plague, for now at least (v4.0 may improve things).

Upvotes: 4

Hannoun Yassir
Hannoun Yassir

Reputation: 21232

if the database already exists i would go with linq to sql(generates mapping from database just by drag and drop) other ways i would chose Nhibernate(helps you generate you database based on your model)

Upvotes: 1

Related Questions