Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is the benefit of Linq ??

0 views
Skip to first unread message

Frank Uray

unread,
Oct 21, 2009, 7:09:01 AM10/21/09
to
Hi all

I am using ADO.NET and T-SQL since many years.
Now tried to use the new Linq to SQL ...

I have made a very simple query and it works fine,
but it is very very slow ... :-((

Now I am not sure what is the benefit of Linq ??
Why should I use Linq, it seams to be slower
and it is also more work because I have to build
my SQL data Model also in a C# class.

Maybe I am doing something wrong,
what are the experience of other developers ??

Thanks for your feedback.

Best regards
Frank Uray

Patrice

unread,
Oct 21, 2009, 8:22:14 AM10/21/09
to
> I have made a very simple query and it works fine,
> but it is very very slow ... :-((

Hard to say without knowing more. Behing the scene it creates a SQL query so
you have some extra time for this generation and the query is not always
optimal. You could use SQL Server profiler to find out the generated
query...

Also it is quite easy to fire the same request multiple times rather than
once.

> Now I am not sure what is the benefit of Linq ??

The idea is to make the data coming from whatever source first classe
citizen inside your programming language. More precisely your usual language
seems to act seamlessly on whatever data storage that has a provider. See
http://msdn.microsoft.com/en-us/library/bb397897.aspx for details.

> Why should I use Linq, it seams to be slower
> and it is also more work because I have to build
> my SQL data Model also in a C# class.

There is nothing wrong on not using Linq if you don't feel a need for it.

> Maybe I am doing something wrong,
> what are the experience of other developers ??

Worked quite well for me though still a bit rough around the edge (I'm also
from the T-SQL days).

--
Patrice


Arnold@arnold.com Mr. Arnold

unread,
Oct 21, 2009, 4:50:39 PM10/21/09
to

"Frank Uray" <Fran...@discussions.microsoft.com> wrote in message
news:9984D2C0-328C-4F20...@microsoft.com...

> Hi all
>
> I am using ADO.NET and T-SQL since many years.
> Now tried to use the new Linq to SQL ...

So have I, but it's ADO.NET Entity Framework that I use, and I don't use
T-SQL anymore if I can avoid it. I use ESQL and Linq-2-Objects against the
Model.

However, there is nothing wrong with T-SQL depending upon the type of
application it's being used in against a database

>
> I have made a very simple query and it works fine,
> but it is very very slow ... :-((

That could be based on the type of query you have put together and the
resulting T-SQL the was generated and executed. It can also be based on you
knowing when to use 'fast' as opposed to 'lazy' loading with Linq-2-SQL or
Link-2-Entities agaist the model.

But if you want speed in querying the model, then you'll use ESQL.

http://blogs.msdn.com/adonet/archive/2008/03/27/ado-net-entity-framework-performance-comparison.aspx

I suggest you find a good book on Linq-2-SQL and ADO .NET Entity Framework.

>
> Now I am not sure what is the benefit of Linq ??

Linq is more than Linq-2-SQL.

What is Language Integrated Query?

LINQ is a Microsoft .NET Framework component that adds native data querying
capabilities to .NET languages.

Microsoft LINQ defines a set of query operators that can be used to query,
project and filter data in arrays, enumerable classes, XML, relational
database, and third party data sources. While it allows any data source to
be queried, it requires that the data be encapsulated as objects. So, if the
data source does not natively store data as objects, the data must be mapped
to the object domain. Queries written using the query operators are executed
either by the LINQ query processing engine or, via an extension mechanism,
handed over to LINQ providers which either implement a separate query
processing engine or translate to a different format to be executed on a
separate data store (such as on a database server as SQL queries). The
results of a query are returned as a collection of in-memory objects that
can be enumerated using a standard iterator function such as C#'s foreach.

Many of the concepts that LINQ has introduced were originally tested in
Microsoft's Cω research project. LINQ was released as a part of .NET
Framework 3.5 on November 19, 2007.

http://en.wikipedia.org/wiki/Language_Integrated_Query


I suggest you find a good book on what Linq is about.


> Why should I use Linq, it seams to be slower
> and it is also more work because I have to build
> my SQL data Model also in a C# class.

I'll give you some words -- object, object oriented programming, design
patterns and enterprise level designing of .NET solutions whether it be a
Web or Windows desktop solution.

It doesn't fit all, biit it does fit a vast majority of it. But the stuff
below is what it's about, and it can be applied to Web UI, Windows Desktop,
Web service, Windows service and Console applications at the enterprise
level.

What is Object-oriented-programming?

(OOP) is a programming paradigm that uses "objects" and their interactions
to design applications and computer programs.

The key concepts of OOP are the following:

Class

Object

Instance

Method

Message passing

Inheritance

Abstraction

Encapsulation

Polymorphism

Decoupling

http://en.wikipedia.org/wiki/Object-oriented_programming

No matter what development platform Java, .Net or others OOP is OOP.

http://math.hws.edu/eck/cs124/downloads/OOP2_from_Univ_KwaZulu-Natal.pdf

http://www.blackwasp.co.uk/ObjectOrientedConcepts.aspx

What are design patterns?

Design patterns are recurring solutions to software design problems you find
again and again in real-world application development. Patterns are about
design and interaction of objects, as well as providing a communication
platform concerning elegant, reusable solutions to commonly encountered
programming challenges.

http://www.developer.com/design/article.php/1502691

Dofactory is fabulous.

http://www.dofactory.com/Patterns/Patterns.aspx

Dofactory also includes Head First Design in C# and VB as opposed to Java
examples in the book.

http://headfirstlabs.com/books/hfdp/

http://computerprogramming.suite101.com/article.cfm/patterns_and_antipatterns

http://msdn.microsoft.com/en-us/library/ms954638.aspx

http://www.designpatternsfor.net/Presentations.aspx?tid=3&cid=4

What is Domain Driven Design?

(DDD) is an approach to the design of software, based on the two premises
[1] that complex domain designs should be based on a model, and that, for
most software projects, the primary focus should be on the domain and domain
logic (as opposed to being the particular technology used to implement the
system).

http://en.wikipedia.org/wiki/Domain-driven_design

What is Test Driven Design?

(TDD) is a software development technique that uses short development
iterations based on pre-written test cases that define desired improvements
or new functions. Each iteration produces code necessary to pass that
iteration's tests. Finally, the programmer or team refactors the code to
accommodate changes. A key TDD concept is that preparing tests before coding
facilitates rapid feedback changes. Note that test-driven development is a
software design method, not merely a method of testing.

http://en.wikipedia.org/wiki/Test-driven_development

http://weblogs.asp.net/rhurlbut/archive/2007/07/16/another-tdd-and-ddd-success-story.aspx

I really can’t find a link on this information. So a link to a book might be
helpful.

http://whitepapers.zdnet.com/abstract.aspx?docid=260168

What is Unified Modeling Language?

(UML) is a standardized general-purpose modeling language in the field of
software engineering. UML includes a set of graphical notation techniques to
create abstract models of specific systems.

http://en.wikipedia.org/wiki/Unified_Modeling_Language

http://www.smartdraw.com/tutorials/software/uml/tutorial_01.htm

What is Model –View- Controller?

(MVC) is an architectural pattern used in software engineering. Successful
use of the pattern isolates business logic from user interface
considerations, resulting in an application where it is easier to modify
either the visual appearance of the application or the underlying business
rules without affecting the other. In MVC, the model represents the
information (the data) of the application; the view corresponds to elements
of the user interface such as text, checkbox items, and so forth; and the
controller manages the communication of data and the business rules used to
manipulate the data to and from the model.

http://en.wikipedia.org/wiki/Model-view-controller

http://msdn.microsoft.com/en-us/library/ms978748.aspx

http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx

http://cristobal.baray.com/indiana/projects/mvc.html

http://www.devx.com/dotnet/Article/29992/0/page/1

What is Model –View- Presenter?

MVP is a software pattern considered a derivative of the
Model-view-controller.

http://en.wikipedia.org/wiki/Model_View_Presenter

http://msdn.microsoft.com/en-us/magazine/cc188690.aspx

http://mrrask.files.wordpress.com/2008/01/model-view-presenter.pdf

http://www.mvcsharp.org/Reworking_ASPNET_MVC_Store/Default.aspx

<http://www.codeproject.com/KB/aspnet/ModelViewPresenter1.aspx?fid=1531640&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2822806#Reusing%20the%20presenter%20in%20windows>

http://codebetter.com/blogs/jeremy.miller/archive/2006/02/01/test-driven-development-with-asp-net-and-the-model-view-presenter-pattern.aspx

MODEL-VIEW-PRESENTER

http://www.polymorphicpodcast.com/

click 'Shows'

click 'Design Patterns Bootcamp: Model View * Patterns*

view parts 1-5

What is Object Relational Mapping?

(ORM) is a programming technique for converting data between incompatible
type systems in relational databases and object-oriented programming
languages. This creates, in effect, a "virtual object database," which can
be used from within the programming language. There are both free and
commercial packages available that perform object-relational mapping,
although some programmers opt to create their own ORM tools.

http://en.wikipedia.org/wiki/O-RM

http://www.objectmatter.com/vbsf/docs/maptool/ormapping.html

What is Language Integrated Query?

LINQ is a Microsoft .NET Framework component that adds native data querying
capabilities to .NET languages.

Microsoft LINQ defines a set of query operators that can be used to query,
project and filter data in arrays, enumerable classes, XML, relational
database, and third party data sources. While it allows any data source to
be queried, it requires that the data be encapsulated as objects. So, if the
data source does not natively store data as objects, the data must be mapped
to the object domain. Queries written using the query operators are executed
either by the LINQ query processing engine or, via an extension mechanism,
handed over to LINQ providers which either implement a separate query
processing engine or translate to a different format to be executed on a
separate data store (such as on a database server as SQL queries). The
results of a query are returned as a collection of in-memory objects that
can be enumerated using a standard iterator function such as C#'s foreach.

Many of the concepts that LINQ has introduced were originally tested in
Microsoft's Cω research project. LINQ was released as a part of .NET
Framework 3.5 on November 19, 2007.

http://en.wikipedia.org/wiki/Language_Integrated_Query

What is Linq-to-SQL?

LINQ to SQL, a component of Visual Studio Code Name "Orcas", provides a
run-time infrastructure for managing relational data as objects without
losing the ability to query. It does this by translating language-integrated
queries into SQL for execution by the database, and then translating the
tabular results back into objects you define. Your application is then free
to manipulate the objects while LINQ to SQL stays in the background tracking
your changes automatically.

http://msdn.microsoft.com/en-us/library/bb425822.aspx

What is ADO.NET Entities framework?

ADO.NET Entity Framework is an object-relational mapping (ORM) framework for
the .NET Framework. This framework is Microsoft's first ORM offering for the
.NET Framework. While Microsoft provided objects to manage the
Object-relational impedance mismatch (such as a DataSet).

ADO.NET Entity Framework is included with .NET Framework 3.5 Service Pack 1
and Visual Studio 2008 Service Pack 1, released on 11 Aug 2008. It also
includes the capability of executing LINQ against ADO.NET Entity Framework
entities

http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework

http://msdn.microsoft.com/en-us/library/aa697427(VS.80).aspx

http://www.springerlink.com/content/kg3216v2014r00u0/

http://blogs.msdn.com/adonet/archive/2008/03/27/ado-net-entity-framework-performance-comparison.aspx


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4530 (20091021) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Jeff Johnson

unread,
Oct 21, 2009, 5:23:48 PM10/21/09
to
"Mr. Arnold" <MR. Arn...@Arnold.com> wrote in message
news:O$p97ApUK...@TK2MSFTNGP05.phx.gbl...

> Many of the concepts that LINQ has introduced were originally tested in

> Microsoft's C? research project.

"C omega"? I smell a code page translation problem....


Mythran

unread,
Oct 21, 2009, 5:59:39 PM10/21/09
to

"Jeff Johnson" <i....@enough.spam> wrote in message
news:O4RiITpU...@TK2MSFTNGP05.phx.gbl...

NO NO NO!

C omega is in development. Will probably come out around December 1st,
2199. Just have to wait for it.

Mythran

Arnold@arnold.com Mr. Arnold

unread,
Oct 21, 2009, 6:32:10 PM10/21/09
to

"Mythran" <Myt...@community.nospam> wrote in message
news:uSclKnpU...@TK2MSFTNGP06.phx.gbl...

Have either one of you used Linq to do anything? Have anyone of you used
Linq in enterprise level solutions, like using Linq on the client-side to
query a backend database using ADO.NET Entity Framework through a WCF
service?

Have anyone of used or created a Linq service provider? Do you even know
what a Linq service provider is about?

Have you used Linq, REST, and an ASP.NET Data service using the ADO .NET
Entity Framework to query a database on the backend from the client?

Maybe you just played with Linq or have never used it at all.

But what it really comes down to is this. Have you done OOPs programming
and do you know how to use objects?

Jeff Johnson

unread,
Oct 21, 2009, 8:13:05 PM10/21/09
to
"Mr. Arnold" <MR. Arn...@Arnold.com> wrote in message
news:%23xJ9f5p...@TK2MSFTNGP04.phx.gbl...

> Have either one of you used Linq to do anything?

[Excessive condescending questions snipped.]

Nope. I just figured that there was a problem with what you copied and
pasted. After following the URL in your post, however, I see that C<lower
case omega> ACTUALLY DOES EXIST. I thought such a name was so dumb that it
couldn't possibly be real. I was wrong. Doesn't excuse the incredible
snarkiness of your response, in my opinion.


Arnold@arnold.com Mr. Arnold

unread,
Oct 21, 2009, 9:04:18 PM10/21/09
to

"Jeff Johnson" <i....@enough.spam> wrote in message
news:%238$MtxqUK...@TK2MSFTNGP05.phx.gbl...

I am not here to please anybody. And when you post to me, you had better be
correct, as I'll accept nothing else.

0 new messages