Pregled posta

Adresa bloga: https://blog.dnevnik.hr/rcosic

Marketing

ORM of the future (LINQ)

Let's continue with the lammentation of the second "ORM of the future":

Language Integrated Query (LINQ)



LINQ is a Microsoft's invention, released as a part of .NET Framework 3.5 on November 19, 2007.

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 - so, it's not limited to a database storage. 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.
The results of a query are returned as a collection of in-memory objects that can be enumerated.

That reminds me to Repository pattern from M. Fowler and usage of ActiveRecord. Well, acually, you have this ActiveRecord pattern entangled inside the SandCastle project's application building block. Well, actually, all these solutions mingle with each other, and I admit, it's really hard to say the real differences.

The expression trees are at the core of LINQ extensibility mechanism, by which LINQ can be adapted for any data source. The expression trees are handed over to LINQ Providers, which are data source-specific implementations that adapt the LINQ queries to be used with the data source. The LINQ Providers analyze the expression trees representing the query ("query trees") and generate a DynamicMethod (which are methods generated at runtime) by using the reflection APIs to emit CIL code. These methods are executed when the query is run.

The power of LINQ reflects with the usage of the LINQ Providers for: in-memory object collections, SQL Server databases, ADO.NET datasets and XML documents. These different providers define the different flavors of LINQ: LINQ to Objects, LINQ to XML, LINQ to SQL, and LINQ to DataSets.

The LINQ providers can be implemented by third parties for various data sources as well:
Data Services: LINQ to ADO.NET Data Services
Entity Framework: LINQ to Entities
DLinq: LINQ to MySQL, PostgreSQL, Oracle, Ingres, SQLite and Microsoft SQL Server
Google search: LINQ to Google
Windows Search: LINQ to System Search
NHibernate: LINQ to NHibernate

In the last post of this subject, I will present the third king - ADO.NET Entity Framework. Until then...

Post je objavljen 24.10.2008. u 20:50 sati.