Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between NHibernate, Castle, Linq - Who are they aimed at?

This answer says that Linq is targeted at a slightly different group of developers than NHibernate, Castle, etc.

Being rather new to C#, nevermind all the DB stuff surrounding it:

  • Are there other major, for lack of a better term, SQL wrappers than NHibernate, Castle, Linq?
  • What are the differences between them?
  • What kind of developers or development are they aimed at?

-Adam

like image 205
Adam Davis Avatar asked Sep 17 '08 12:09

Adam Davis


2 Answers

When you say Castle I assume you mean Castle Active Record?

The difference is NHibernate is an OR/M and is aimed at developers who want to focus on the domain rather than the database. With linq to sql, your database is pre-existing and you're relationships and some of programming will be driven by how your database is defined.

Now between NHibernate and Castle ActiveRecord -- they are similar in that you're driving your application design from the domain but with NHibernate you provide mapping xml files (or mapping classes with fluent NHibernate) where in Active Record you are using the convention over configuration (using attributes to define any columns and settings that don't fit naturally). Castle Active record is still using NHibernate in the background.

One OR/M is not necessarily the 'one true way' to go. It depends on your environment, the application your developing and your team.

You may also want to check out SubSonic. It's great for active record but it is not for project where you want to focus mainly on your Domain. Depending on the project, I usually use either NHibernate (with Castle Active Record) or Subsonic

like image 167
Ryan Lanciaux Avatar answered Oct 17 '22 03:10

Ryan Lanciaux


LINQ is just a set of new C# features: extension methods, lambda expressions, object initializers, anonymous types, etc.

"LINQ to SQL" on the other hand is something you can compare other SQL wrappers.

like image 31
Hallgrim Avatar answered Oct 17 '22 03:10

Hallgrim