Loading...
Area: Episerver Search & Navigation
Applies to versions: 12 and higher
Other versions:

Inheritance and interfaces

Recommendations [hide]

This topic describes inheritance when using the Client class and interfaces in the .NET Client API for Episerver Search & Navigation (formerly Episerver Find).

How it works

When you are searching using the Client class, inheritance is supported out of the box. For example, you have two classes, User and Author. If you search for users, you also get matching authors back.

Example

searchResult = client.Search<User>()
    .For("John")
    .InField(x => x.Name)
    .GetResult();

var isUser = (searchResult.First is User);
//isUser IS true

var isAuthor = (searchResult.First is Author);
//isAuthor MIGHT be true

You also can search over all types that implement a specific interface.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Oct 31, 2016

Recommendations [hide]