see on GitHub

Conventions

Conventions give you the ability to customize the Client API behavior. They are accessible from the DocumentStore object:

using (var store = new DocumentStore()
{
    Conventions =
    {
        // customizations go here
    }
}.Initialize())
{

}

You will find many settings to overwrite, allowing you to adjust the client according to your needs. The conventions apply to many different client behaviors. Some of them are grouped and described in the separate articles of this section.

Information

All customizations need to be set before DocumentStore.Initialize() is called.

MaxHttpCacheSize

If you need to modify the maximum http cache size, you can use the following setting:

MaxHttpCacheSize = new Size(256, SizeUnit.Megabytes)

Default size

The default value of this setting is configured as follows:

  • running on 64 bits:

    • if usable memory is lower than or equal to 3GB: 64MB,
    • if usable memory is greater than 3GB and lower than or equal to 6GB: 128MB,
    • if usable memory is greater than 6GB: 512MB,
  • running on 32 bits: 32MB.

The cache is created per database you use.

Disable caching

To disable the caching you can set the MaxHttpCacheSize value to zero:

MaxHttpCacheSize = new Size(0, SizeUnit.Megabytes)

In this scenario all the requests will be sent to the server to fetch the data.

MaxNumberOfRequestsPerSession

Gets or sets maximum number of GET requests per session. Default: 30.

MaxNumberOfRequestsPerSession = 10

UseOptimisticConcurrency

Controls whether optimistic concurrency is set to true by default for all future sessions. Default: false.

UseOptimisticConcurrency = true

RequestTimeout

It allows you to define the global request timeout value for all RequestExecutors created per database. Default: null.

RequestTimeout = TimeSpan.FromSeconds(90)

DisableTopologyUpdates

Forces you to disable updates of database topology. Default: false.

DisableTopologyUpdates = false

SaveEnumsAsIntegers

It determines if C# enum types should be saved as integers or strings and instructs the LINQ provider to query enums as integer values. Default: false.

SaveEnumsAsIntegers = true

UseCompression

It determines if the client will send headers to the Server indicating that it allows compression to be used. Default: true.

UseCompression = true