Some suggestions on which .NET ORM to look at learning

前端 未结 9 963
陌清茗
陌清茗 2020-12-10 06:34

I am a little ashamed to say that I have never used an ORM; as you may recall most of my career experience is hacking around with Classic ASP and the little .NET I do tends

9条回答
  •  清歌不尽
    2020-12-10 07:13

    I second David Robbins's mention of subsonic. One downfall that I will point out though is that the documentation is less than perfect. It's really pretty simple to work with, you just have to know how to do it.

    I suppose one other thing that's worth mentioning: what databases do you need to support? If you need to work with anything other than SQL Server, I wouldn't use LINQ. I could be wrong on this, but last time I checked, there isn't any good support for databases other than SQL Server.

    The last thing that I would mention is that you don't have to choose just one. I've used nHibernate, LINQ to SQL, and Subsonic in the same project with decent success (although I'd advise to avoid that if at all possible). My advice is to spend a little bit of time with all of them and learn what's best about each one.

    Here's what I would say about each one:

    • LINQ to SQL - very easy to get up and running with. But if you want to use something other than SQL Server, you're pretty much SOL.
    • NHibernate - This is probably the most powerful out of all the ORMs and it supports the most RDBMSes, but it can be tedious to work with as there aren't a lot of really good free code generators to work with (can't speak for the non-free ones though).
    • SubSonic - A good compromise between NHibernate and LINQ to SQL. It doesn't support as many RDBMSes as NHibernate, but it works with most of the ones you'd encounter in the business world.

    TL;DR: NHibernate if you need to have a lot of control over the database or need to support something obscure. SubSonic if you need to work with something other than SQL Server. LINQ to SQL if you just want to run against SQL Server.

提交回复
热议问题