DataSource for Entity Framework in WPF
LiveLinq / How to use LiveLinq / How to use Indexes Programmatically
In This Topic
    How to use Indexes Programmatically
    In This Topic

     

    Indexes are used by LiveLinq to optimize query execution, but they are also accessible for programmatic use. You can use indexes directly in code, calling methods of the Index<T> class to perform a variety of fast searches. This makes LiveLinq indexes useful even outside the framework of LINQ, outside queries.

    For example, searching for a particular value can look like this:

    C#
    Copy Code
    indexByCity.Find("London")
    

     

    or even like this:

    C#
    Copy Code
    indexByCity.FindStartingWith("L")
    

    The Index<T> class also has other methods for performing fast searches and fast joins and groupings that can be useful in any code, not just in queries: FindGreater|keyword=FindGreater Method, FindBetween|keyword=FindBetween Method, Join, GroupJoin, and a few others.

    Examples of programmatic searches (without LINQ) can be found in the LiveLinq indexing demo, see Query Performance sample application (LiveLinqQueries). In fact, every query that is shown in that demo has an alternative implementation via direct programmatic search in code without LINQ.