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?
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?
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)
There are some previous SO posts that may help you:
and also some about Nhibernate to Linq:
http://stackoverflow.com/questions/624609/linq-to-nhibernate
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).
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.
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.
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.
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.