Skip to main content

Conventions related to request handling

#Conventions related to request handling

Instruct the client to do parallel MultiGet processing when handling lazy requests. It is enabled by default.

Conventions.UseParallelMultiGet = true;

AllowMultipuleAsyncOperations

Enable or disable multiple async requests per client instance. By default only a single concurrent async request is allowed.

Conventions.AllowMultipuleAsyncOperations = false;

HandleForbiddenResponseAsync

The async function that begins the handling of forbidden responses.

Conventions.HandleForbiddenResponseAsync = (forbiddenResponse, credentials) => 

HandleUnauthorizedResponseAsync

It begins the handling of unauthenticated responses, usually by authenticating against the oauth server in async manner.

Conventions.HandleUnauthorizedResponseAsync = (unauthorizedResponse, credentials) =>

CustomizeJsonSerializer

If you need to modify JsonSerializer object used by the client you can register a customization action:

Conventions.CustomizeJsonSerializer = serializer => { };

JsonContractResolver

The default JsonContractResolver used by RavenDB will serialize all properties and all public fields. You can change it by providing own implementation of IContractResolver interface:

Conventions.JsonContractResolver = new CustomJsonContractResolver();
public class CustomJsonContractResolver : IContractResolver
{
public JsonContract ResolveContract(Type type)
{
throw new CodeOmitted();
}
}

PreserveDocumentPropertiesNotFoundOnModel

Controls whatever properties that were not de-serialized to an object properties will be preserved during saving a document again. If false, those properties will be removed when the document will be saved. Default: true.

Conventions.PreserveDocumentPropertiesNotFoundOnModel = true;