18     C# Scripting

The Language Integrated Query - LINQ is a Microsoft .NET Framework technology that adds native data querying capabilities to .NET languages. LINQ enables developers to form set-based queries in their application code, without having to use a separate query language.

 

You can write LINQ queries against various enumerable data sources, such as in-memory data structures, XML documents, SQL databases, and DataSet objects. Although these enumerable data sources are implemented in various ways, they all expose the same syntax and language constructs. Because queries can be formed in the programming language itself, you do not have to use another query language (like SQL) that is embedded as string literals that cannot be understood or verified by the compiler.

 

There are three separate ADO.NET Language-Integrated Query (LINQ) technologies: LINQ to Dataset, LINQ to SQL, and LINQ to Entities. LINQ to Dataset provides richer, optimized querying over the DataSet and LINQ to SQL enables you to directly query SQL Server database schemas, and LINQ to Entities allows the user to query an Entity Data Model.

The following diagram provides an overview of how the ADO.NET LINQ technologies relate to high-level programming languages and LINQ-enabled data sources.

 

image

LINQ Architecture

 

LINQ Query editor is an innovative feature and can run dynamically LINQ Query scripts. It supports currently LINQ to Entities (Entity Framework), LINQ to DataSet, LINQ to Objects and LINQ to XML queries. The LINQ query feature is currently supported for MS SQL Server, IBM DB2, MySQL, PostgreSQL, SQLite, FireBird, EffiProz database engines. Support for Oracle, MongoDB and Informix engines will be implemented soon.

 

Note:

Microsoft LINQ to SQL technology is not supported.

 

18.1                Result Output

After executing the query script, you can dump the results using Output method. The Dump method detects automatically the given object list and visualize the data as a table or a tree view.

 

18.2                Linq to Entity Framework

ADO.NET Entity Framework (EF) is an object-relational mapping (ORM) framework for the .NET Framework. ADO.NET Entity Framework abstracts the relational (logical) schema of the data that is stored in a database and presents its conceptual schema to the application.

The ADO.NET Entity Framework enables developers to create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema. The goal is to decrease the amount of code and maintenance required for data-oriented applications. 

 

If you open the LINQ Query Editor, the conceptual schema or Database Object Context (Database Access Layer) will be generated automatically using EDM generator. The user can access the all database Entities and Objects and execute C#/VB.Net code.

 

Info:

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

 

18.3                Linq to DataSet

BI Studio allows the user to execute Linq to DataSet code against any database system. LINQ to DataSet makes it easier and faster to query over data cached in a DataSet object. Specifically, LINQ to DataSet simplifies querying by enabling developers to write queries from the programming language itself, instead of by using a separate query language. This is especially useful for Microsoft Visual Studio developers, who can now take advantage of the compile-time syntax checking, static typing.

 

LINQ to DataSet can also be used to query over data that has been consolidated from one or more data sources. This enables many scenarios that require flexibility in how data is represented and handled, such as querying locally aggregated data and middle-tier caching in applications.

 

The LINQ to DataSet functionality is exposed primarily through the extension methods in the DataRowExtensions and DataTableExtensions classes. 

 

 

 

For more help:

LINQ Basic Info:       http://en.wikipedia.org/wiki/Language_Integrated_Query

LINQ to Entities:       http://msdn.microsoft.com/en-us/library/bb399367.aspx

LINQ to XML:                       http://msdn.microsoft.com/en-us/library/bb387098.aspx

LINQ to DataSet:      http://msdn.microsoft.com/en-us/library/bb386977.aspx

LINQ to Objects:      http://msdn.microsoft.com/en-us/library/bb397919.aspx

 

 

 

 


powered by Nucleon Software