views:

1117

answers:

8

There are so many different options coming out of microsoft for data access. Which one is the best for scalable apps?

Linq

Should we be using Linq? It certainly seems easy but if you know your SQL does it really help. Also I hear that you can't run Async queries in ASP.NET using Linq. Therefore I wonder if it is really scalable? Are there any really big sites using Linq (With the possible exception of stackoverflow).

Entity Framework

Don't hear so much razzmatazz about the Entity Framework. Seems closer to the Object model I'm familure with.

Astoria/Dynamic Data

Should we be exposing our data as a service?

I'm pretty confused and thats before I get into the other ORM products like NHibernate. Any ideas or wisdom on which is better?

+15  A: 

I think ADO.Net Data Services (formerly called Astoria) has a huge role to play. It fits nicely with the REST style architecture of the web.

Since web is scalable, I guess anything which follows its architecure is scalable too.. Also, you might want to keep a lookout for SQL Server Data Services..

Gulzar
Has anyone used ADO.Net Data Services for a large app yet?
Leo Moore
ADO.Net data services just got released. My emphasis was more on REST.
Gulzar
Yes, there are a number of large ADO.NET Data Services sites already. A number of folks went live early on in Beta. It is released now. I would focus on Entity Framework and ADO.NET Data Services. Avoid Linq 2 SQL.
Scott Hanselman
+1  A: 

Use whatever works for you. These are all easiest to set up if you already have a fairly normalized database (ie, good definition of primary keys and foreign keys). However, if you've got data that doesn't easily normalize, the Entity Framework is more flexible than LINQ to SQL, but it does take more work to configure.

foxxtrot
+1  A: 

We've been experimenting with LINQ in a clustered environment and it appears to be scaling well on the individual machines and across the cluster. Of the 3 options that you've provided I would say that LINQ is the better choice although each option has a slightly different target audience so you should define what you will be doing with the data before deciding on the acesss paradigm.

Guy
Its good to know that you've been using it successfully in a clustered environment. Do you have any rough stats on transaction throughput?
Leo Moore
+4  A: 

If you are talking about relational databases, then my vote is for encapsulating all of your data operations in stored procedures, regardless of how you access them from the other layers.

If you disable all read/write access to the database, except via stored procedures, you can hide your data model behind well defined contracts. The data model is free to change, just so the stored procedures still honor their inputs and outputs.

This gives DBAs total freedom to tune your application and make it scale. This is a very, very difficult task when SQL is being generated by a tool outside of the database.

Eric Z Beard
Hi Eric, Thanks for your input. I think it goes without saying that using stored procedures is a good way to optomise query performance. as far as I know you can use stored procedures with Linq
Leo Moore
You can, but it sort of downgrades the LinqToSql experience.
Eric Z Beard
+1  A: 

I would suggest linq. It scales well on our site and is simple enough to use.

+1  A: 

use stored procedures with LINQ...but don't let the sprocs turn into a data access layer!

+14  A: 

I would recommend either NHibernate or Entity Framework. For large sites, I'd use ADO.NET Data Services. I wouldn't do anything large with LINQ to SQL. I think Stack Overflow might end up with some interesting scale problems being 2-tier rather than 3-tier, and they'll also have some trouble refactoring as the physical aspects of the database change and those changes ripple throughout the code. Just a thought.

Scott Hanselman
I think you are right about Linq. It seems handy but not an enterprise solution. I really don't want to have my object model too closely tied to my DB. Thanks, I'll do some research into the other options.
Leo Moore
Leom, I think you are using the word Linq interchangeably with Linq to SQL. Linq is a broad term, an expression syntax sugar on top of any kind of collection/object/xml/*.*
Vin
Right, and remember that LINQ to SQL is LINQ to *SQL SERVER*
Scott Hanselman
+3  A: 

Locking into stored procedures seems to be a waning way of thought these days, at least that have been my current observations. That way of thinking does lend itself to the ORM world since they are typically more affective going against tables directly but any ORM worth their salt will also allow the use of procs – sometime you have no choice.

There is plenty of opinions around EF and regardless of what anyone says, good or bad, it is a V1 product and with the rule of thumb that MS takes about 3 revs to get it right it might be prudent to wait for the next rev at least.

It seems that the biggest player out there in this space is NHibernate and there is plenty of support for this in the community. Linq, the language feature, shouldn’t be too far off in making its way to the NHibernate stack.

MotoWilliams