Migration: Changes in Conventions

All conventions needs to be set before DocumentStore.Initialize is called.
Otherwise, an InvalidOperationException will be thrown.

Namespace

Raven.Client.Document.DocumentConvention has been renamed and moved to Raven.Client.Documents.Conventions.DocumentConventions.

Entity Serialization and Deserialization

Serialization and deserialization of entities can be customized using:

  • CustomizeJsonSerializer
  • DeserializeEntityFromBlittable

new DocumentStore
{
    Conventions =
    {
        CustomizeJsonSerializer = serializer => throw new CodeOmitted(),
        DeserializeEntityFromBlittable = (type, blittable) => throw new CodeOmitted()
    }
}.Initialize();

In order to customize bulk insert serialization you can use BulkInsert.TrySerializeEntityToJsonStream convention:

new DocumentStore
{
    Conventions =
    {
        BulkInsert =
        {
            TrySerializeEntityToJsonStream = (entity, metadata, writer) => throw new CodeOmitted(),
        }
    }
}.Initialize();

DocumentKeyGenerator

The DocumentKeyGenerator has been removed. Use AsyncDocumentIdGenerator instead.

DefaultQueryingConsistency

DefaultQueryingConsistency convention has been removed. Check the related article discussing how to deal with non stale results.

DefaultUseOptimisticConcurrency

The DefaultUseOptimisticConcurrency has been renamed to UseOptimisticConcurrency.

FindIdentityPropertyNameFromEntityName

The FindIdentityPropertyNameFromEntityName has been renamed to FindIdentityPropertyNameFromCollectionName.

FindTypeTagName and FindDynamicTagName

Renamed to FindCollectionName and FindCollectionNameForDynamic.

IdentityTypeConvertors

It has been removed. Only string identifiers are supported.

FailoverBehavior

The client will failover automatically to a different node in the cluster.
The Read requests can be customized by using the ReadBalanceBehavior convention.

EnlistInDistributedTransactions

The support for DTC transactions has been dropped.

UseParallelMultiGet

Removed. The multi gets are processed in async manner on the server side.

TransformTypeTagNameToDocumentKeyPrefix

Renamed to TransformTypeCollectionNameToDocumentIdPrefix.

RegisterIdConvention

Renamed to RegisterAsyncIdConvention

RegisterIdLoadConvention

Removed. Use RegisterAsyncIdConvention.

ReplicationInformerFactory

ShouldAggressiveCacheTrackChanges and ShouldSaveChangesForceAggressiveCacheCheck

The client listens to changes by default and evicts cached items if they change on the server side.

IndexAndTransformerReplicationMode

Removed. Indexes are automatically replicated within the cluster. Transformers has been removed completely.

RequestTimeSlaThresholdInMilliseconds

Use ReadBalanceBehavior.FastestNode to if you need to ensure that get requests will executed against the fastest node in the cluster.

TimeToWaitBetweenReplicationTopologyUpdates

AllowQueriesOnId

Removed. In 4.0 queries on IDs are supported by default.

ShouldCacheRequest

Removed. There is no longer option to determine caching per request. Cache size can be controlled using MaxHttpCacheSize convention.

Do you need any help with Migration?