LinqDataSource and ObjectDataSource

  • Thread starter Thread starter Harlan Messinger
  • Start date Start date
H

Harlan Messinger

What is the added value of a LinqDataSource with respect to an
ObjectDataSource? Basically, both of them can take an IEnumerable<T> as
a data source, correct?
 
Harlan Messinger said:
What is the added value of a LinqDataSource with respect to an
ObjectDataSource? Basically, both of them can take an IEnumerable<T> as a
data source, correct?

Linqdatasource can generate sql to go read a database. But don't.

Separation of concerns.
You could stick a sqldatasource or linqdatasource in a web page and they
kind of work.
But you shouldn't be putting data access code in the view layer.

So use objectdatasource.

The sqldatasource is one of them things you saw in magazine articles but
never in any kind of business application.
Linqdatasource is pretty much the same kind of deal.
 
Andy said:
Linqdatasource can generate sql to go read a database. But don't.

Separation of concerns.
You could stick a sqldatasource or linqdatasource in a web page and they
kind of work.
But you shouldn't be putting data access code in the view layer.

I didn't think of it as view layer. I thought of it as a proper
encapsulation of data access and manipulation operations, which can then
be used to supply data to and receive it from the view layer (ListView,
DetailView, etc.).
So use objectdatasource.

In what pertinent ways is this different from the LinqDataSource? I
don't know the answer to that--that's kind of why I had asked my question.
 
Harlan said:
What is the added value of a LinqDataSource with respect to an
ObjectDataSource? Basically, both of them can take an IEnumerable<T> as
a data source, correct?

A LinqDataSource can use Link-2-SQL or ADO.Net.Entity Framework as the
mechanism to do CRUD operations with the data stor. A LinqDataSource
allows for the querying of the data stor using 'Linq'.

There is a new boy on the block called DomainDataSource that uses
Linq-2-SQL or ADO.NET Entity Framework, which automatically builds the
middle tier and business object for CRUD operations against the data
stor, which works with WCF RIA Service.
 
Back
Top