views:

1976

answers:

4

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?
+16  A: 

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

Ryan Lanciaux
+1  A: 

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.

Hallgrim
+1  A: 

NHibernate and Linq To Sql are Object/Relational Mappers designed to ease dealing with the impedence mismatch found between objects and RDBMS. If you where want to achieve a testable, persistant ignorant application, NHibernate is the way to go. I would always recommend NHibernate over Linq To Sql. Both tools are aimed at removing dealing with data access. How many times do you really need to write data access code?

Castle is an application framework and Inversion of Control container and doesn't provide data access. It supplies facilities for using NHibernate, making for less friction, and it also supplis an implemenation of the Actuve Record pattern using NHibernate.

Chris Canal
+1  A: 

Actually we use both Linq and NHibernate together (with Fluent). If you have a little patience with the learning curve, then you will quickly fall in love.

Perhentian