Table of Contents

LINQ Overview

The Scaleout.Client library supports queries through a LINQ provider, allowing you to locate objects in the store that satisfy query expressions specified using LINQ.

Add a using Scaleout.Client.QuerySupport directive to the top of a C# source file to add the QueryObjects() extension method to the Cache class. The QueryObjects method returns an IQueryable instance that supports LINQ queries against the ScaleOut service.

Types of Filters

Enumerating over the IQueryable instance returned by QueryObjects() allows you to iterate over every object in a cache. For large caches this would be slow and expensive, so items are typically filtered on the server using a LINQ expression such as a Where clause.

The ScaleOut.Client library supports two kinds of filters:

  • Filtering by Property: Define an index on a class property in the ScaleOut service (using the [SossIndex] attribute), which allows you to use that property in a LINQ Where clause.
  • Filtering by Tag: Assign one or more string tags to an object at add/update time, and then use the LINQ provider's tag operators to filter objects based on their tag values.