Showing posts with label What Is LINQ?. Show all posts
Showing posts with label What Is LINQ?. Show all posts

Friday 30 March 2012

What Is LINQ?

LINQ is a uniform programming model for any kind of data access. LINQ enables you to query and manipulate data independently of data sources. Below figure 'LINQ' shows how .NET language stands over LINQ programming model and works in a uniformed manner over any kind of data source. It’s like a query language which can query any data source and any transform. LINQ also provides full type safety and compile time checking.
LINQ can serve as a good entity for middle tier. So it will sit in between the UI and data access layer.
 


Figure - LINQ



Below is a simple sample of LINQ. We have a collection of data ‘objcountries’ to which LINQ will is making a query with country name ‘India’. The collection ‘objcountries’ can be any data source dataset, datareader, XML etc. Below figure ‘LINQ code snippet’ shows how the ‘ObjCountries’ can be any can of data. We then query for the ‘CountryCode’ and loop through the same.


Figure: - LINQ code snippet

Thursday 5 January 2012

What Is LINQ?

Language INtegratedQuery (LINQ)

•New programming model for data access that integrates query support directly within the .NET languages
•Designed to reduce the complexity when working with data
•Query operators can be used against any collection
–Built-in examples: Select, Where, GroupBy, Join, etc.
–Extensibility model supports extending/replacing these
•Benefits
–Work with data in a consistent way, regardless of the type of data
–Interact with data as objects
–Better integration with programming languages
–Improved productivity through IntelliSense in Visual Studio


LINQ is a uniform programming model for any kind of data. LINQ enables you to query
and manipulate data with a consistent model that is independent from data sources.
LINQ is just another tool for embedding SQL queries into code.
LINQ is yet another data abstraction layer.
LINQ is a methodology that simplifies and unifies the implementation of any kind of data
access. LINQ does not force you to use a specific architecture; it facilitates the implementation
of several existing architectures for accessing data. As with every tool, it can be used in both
good and in bad ways. To get the most out of LINQ, you will have to master it.