linq and asp.net
am 03.01.2008 14:34:02 von Nedim
I am starting a new web application and I was planning on using linq but i
have a bunch of problems.
most forms will display some data from the database, but there always has to
be a filtering support - you need to be able to filter the data based on one
or more columns (I make the filter in runtime). The data also has to be paged
(with user selected sort column).
First I wanted to use the LinqDataSource for this, but it does not have a
Refresh method and filtering via parameters from controls doesnt work. I
tried then making my own linq query and binding listview on it, but then
datapager doesnt work properly (that is, it doesnt work at all).
so please help, should i go back to the datasets which require a lot more
work, or is there a way to make use of the linq queries - i need to be able
to make pager work (or some other way to display page numbers and them to be
working links) and to be able to have more fields for filtering?
pls help
thanx in advance,
Nedim
Re: linq and asp.net
am 03.01.2008 15:02:16 von mark
"Nedim" wrote in message
news:57FE2D36-A205-43A2-805F-6739E5E5D86B@microsoft.com...
> so please help, should i go back to the datasets which require a lot more
> work, or is there a way to make use of the linq queries - i need to be
> able
> to make pager work (or some other way to display page numbers and them to
> be
> working links) and to be able to have more fields for filtering?
I think the debate on Linq is likely to become almost as heated as the C# vs
VB.NET debate we started back in 2002 which, thankfully, has pretty much
gone away now...
My personal opinion (so far) is that Linq is superb at allowing .NET objects
to be queried using SQL syntax *as if* they were data tables, but I haven't
really found any need to use Linq to query an actual database... That's
almost certainly because I never go anywhere near the SqlDataSource /
AccessDataSource etc objects - instead, I have a standard DAL which I use
for all database work so, once the connection string is in place, any
individual query is usually just one line of C# code...
There's an interesting take on this here:
http://blogs.msdn.com/ploeh/archive/2007/02/10/HowWillLINQIm pactDatabaseDevelopmentBestPractices.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Re: linq and asp.net
am 03.01.2008 15:18:00 von Nedim
well my biggest problem is paging (with filtering) and i've always had
trouble doing that. linq seemed like a good solution for that, but there is
just too many unfinished (or maybe things I havent found out yet) to make it
useful for everything - again, i think that filtering and refresh method on
linqdatasource are pretty basic things.
and now with so many new things in .net 3.5 and new project, i want to use
all the benefits of a new enviroment that i can, so I'm still not sure what
to do and how to do it - separate dal project, should the dal use datasets,
linq or both, and what is the best way to do paging - pager control seemed
godsend, but it doesnt work with anything other then linqdatasource.
"Mark Rae [MVP]" wrote:
> "Nedim" wrote in message
> news:57FE2D36-A205-43A2-805F-6739E5E5D86B@microsoft.com...
>
> > so please help, should i go back to the datasets which require a lot more
> > work, or is there a way to make use of the linq queries - i need to be
> > able
> > to make pager work (or some other way to display page numbers and them to
> > be
> > working links) and to be able to have more fields for filtering?
>
> I think the debate on Linq is likely to become almost as heated as the C# vs
> VB.NET debate we started back in 2002 which, thankfully, has pretty much
> gone away now...
>
> My personal opinion (so far) is that Linq is superb at allowing .NET objects
> to be queried using SQL syntax *as if* they were data tables, but I haven't
> really found any need to use Linq to query an actual database... That's
> almost certainly because I never go anywhere near the SqlDataSource /
> AccessDataSource etc objects - instead, I have a standard DAL which I use
> for all database work so, once the connection string is in place, any
> individual query is usually just one line of C# code...
>
> There's an interesting take on this here:
> http://blogs.msdn.com/ploeh/archive/2007/02/10/HowWillLINQIm pactDatabaseDevelopmentBestPractices.aspx
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>
Re: linq and asp.net
am 03.01.2008 15:31:45 von Eliyahu Goldin
One of the major challenges in asp.net is to keep your lane straight without
making unnecessary turns.
I have an impression that many asp.net innovations target novice developers
or those who switch over from some other technologies. Developers who have
already made their way and style through the years of practical development,
who already know sql, javascript and all sorts of big and little things,
don't need to rush to switch the paradigm of managing everything in
server-side code modules.
In many cases it is better to use natural database queries without
introducing an extra complexity layer and having to pass through yet another
learning curve.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Mark Rae [MVP]" wrote in message
news:ugzMyEhTIHA.5400@TK2MSFTNGP04.phx.gbl...
> "Nedim" wrote in message
> news:57FE2D36-A205-43A2-805F-6739E5E5D86B@microsoft.com...
>
>> so please help, should i go back to the datasets which require a lot more
>> work, or is there a way to make use of the linq queries - i need to be
>> able
>> to make pager work (or some other way to display page numbers and them to
>> be
>> working links) and to be able to have more fields for filtering?
>
> I think the debate on Linq is likely to become almost as heated as the C#
> vs VB.NET debate we started back in 2002 which, thankfully, has pretty
> much gone away now...
>
> My personal opinion (so far) is that Linq is superb at allowing .NET
> objects to be queried using SQL syntax *as if* they were data tables, but
> I haven't really found any need to use Linq to query an actual database...
> That's almost certainly because I never go anywhere near the SqlDataSource
> / AccessDataSource etc objects - instead, I have a standard DAL which I
> use for all database work so, once the connection string is in place, any
> individual query is usually just one line of C# code...
>
> There's an interesting take on this here:
> http://blogs.msdn.com/ploeh/archive/2007/02/10/HowWillLINQIm pactDatabaseDevelopmentBestPractices.aspx
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
Re: linq and asp.net
am 03.01.2008 15:48:07 von mark
"Eliyahu Goldin" wrote in
message news:%23yaQ1VhTIHA.1208@TK2MSFTNGP03.phx.gbl...
I couldn't agree more.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Re: linq and asp.net
am 03.01.2008 20:35:02 von pbromberg
Yup. LINQ is great, LINQ is cool. To write apps with LINQ, you gotta take
time for LINQ school. (boy, that was profound, huh...)
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"Mark Rae [MVP]" wrote:
> "Eliyahu Goldin" wrote in
> message news:%23yaQ1VhTIHA.1208@TK2MSFTNGP03.phx.gbl...
>
> I couldn't agree more.
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>
Re: linq and asp.net
am 03.01.2008 23:05:24 von mark
"Peter Bromberg [C# MVP]" wrote in message
news:BBA95729-4D65-43A8-8A07-190B7E9C3E50@microsoft.com...
> Yup. LINQ is great, LINQ is cool. To write apps with LINQ, you gotta take
> time for LINQ school. (boy, that was profound, huh...)
Nah - if you'd wanted to be really cool, you'd have rhymed Bromberg with
homburg... ;-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net