Search code examples
nhibernatelinq-to-sqlcastle-activerecord

Should I use Linq-to-SQL or the Castle ActiveRecord implementation?


I don't want to write stored procedures any more (not unless I have to), so should I use out of the box Linq-to-SQL or the Castle ActiveRecord implementation?

I understand there are some differences between the two as mentioned here on Stackoverflow


Solution

  • I'm not sure why you happen to be choosing between those two only?

    LinqToSql currently has a better Linq provider than NHibernate.

    Castle ActiveRecord is based on NHibernate. NHibernate is a lot more feature rich than LinqToSql and features are being added much more quickly to NHibernate.

    Depending on the complexity of your domain, data model, and requirements, you may be forced to go with NHibernate at some point because LinqToSql just can't do what you need it to do (you haven't specified what kind of environment and requirements you have, which makes a big difference).

    It can be difficult/expensive to transition from one ORM to another, so it is important to choose wisely.

    There are some situations where I would recommend LinqToSql over Castle ActiveRecord, but they are few and far between. Generally, Castle ActiveRecord is much more likely to work in your situation.