Try our conversational search powered by Generative AI!

Loading...
Area: Optimizely Search & Navigation
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Introduction

When objects returned in search results etc are deserialized, they are instantiated by the JSON.NET serializer. If some custom action is required when instantiating the objects, the instantiation can be customized using the Client conventions.

Examples

An example of configuring custom instantiation can look like this:

C#
//using EPiServer.Find.ClientConvetions;

client.Conventions.ForType<BlogPost>()
    .CreateUsing(() => new BlogPost("someCtorParamValue"));

Note that if indexed objects are so complex that they require custom instantiation, they are often not suitable as search results and it might be better to project the search results to some other simpler class using the Select method.

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

Last updated: Apr 03, 2014

Recommended reading