NCache Language Integrated Query (LINQ)
Language Integrated Query (LINQ) is a generic query language for various data sources like relational databases, XML, ADO.NET DataSet and so on. LINQ sets a common standard through which data can be accessed, as it simply joins the application's object layer to data layer. Since LINQ has the same syntax for all data source types, there is no change required in the retrieval format of code if you change the type of data source in your .NET application.
NCache provides a LINQ provider which facilitates execution of LINQ queries over the distributed cache. This improves the application’s performance without changing the LINQ object model. NCache LINQ provider converts LINQ related query into NCache's extended SQL format and returns the result accordingly after transforming it in LINQ format.
Note that NCache supports both syntaxes of writing a LINQ query, either as simple LINQ or through Lambda expressions. For example to search the cache for a product with ProductID = 1001, the query can be executed with both syntaxes, to suit your application needs:
- Lambda expression
var result = products.Select(p => p).Where(p => p.ProductID == 1001);
- Query expression
var result = from p in products where p.ProductID == 1001 select p;
NCache requires all searchable attributes to be indexed. NCache provides its own indexing mechanism through which the users can identify objects in .NET assemblies that they want to index. See the section Indexing for details.
In This Section
Search Objects with LINQ
Explains how to use LINQ query based on NCache Query Language.
Provides examples for each supported operator in LINQ.
Configuring LINQPad for NCache
Provides steps to configure LINQPad to query over NCache data seamlessly.
Querying NCache Data in LINQPad
Explains how objects in NCache can be queried over using LINQPad.