LinQ
LINQ, stands for Language Integrated Query, is a component of Microsoft .net framework. Introduced with .net 3.5, LinQ is considered a great tool for accessing data.
LinQ has proven to have many advantages:
- LinQ is integrated into .net with full intellisense supported by Visual Studio. It is strong type language, which will help data accessing code can has less run-time errors.
- LinQ make it easy to transform data to objects without too much effort.
- LinQ is a single language that can be used to access data from different type of data sources. That could help developers have fewer things to learn. It can be extended to use for accessing any type of data by creating new LinQ Provider. After accessing different data sources, the data then can be merged within LinQ without explicitly joining data in the database.
- LinQ language is short and direct, that help developers to write less code.
- Accessing and updating data in LinQ is delayed in execution. In many cases, developers can work with data objects, while don’t have to take the actual data from databases until you explicitly require LinQ to do so. Without the actual data, you still can work with data objects in LinQ including changing object properties, deleting existing objects or adding new object, but every changes will only be recorded to the database when you call the “submit changes” method of the data context.That delayed in execution, connecting a database only when it really necessary,could improve an application performance.
- All variables in LinQ use Sql parameters by default that would help developers spend no time on protecting applications from Sql injection.
- LinQ can help to transform data from one type to another, for example developers can query data from a SQL server database then transform it to Xml.
LinQ still has its own problems. For complex query a database, the generated SQL from LinQ can be over complicated and affect application performance. Some functions of LinQ such as pagination through a record set is supposed to be used with Sql server 2005 or later, and you will need to write extra Sql code for older Sql version. How ever, most of the time it will work well. When being used correctly, it will certainly improve both application performance and programming jobs.
Tags:language integrated querylinqsql server 2005
