Пример #1
0
        /// <summary>
        ///     Adds partitioned MongoDB storage of <paramref name="valueType"/> with <paramref name="keyType"/>.
        /// </summary>
        public static StorageBuilder AddMongoPartitioned(this StorageBuilder builder, Type keyType, Type valueType)
        {
            var serviceType        = typeof(IPartitionedStorageProvider <>).MakeGenericType(valueType);
            var implementationType = typeof(MongoPartitionedStorageProvider <>).MakeGenericType(valueType);

            builder
            .AddMongoHistorical(keyType, valueType)
            .Services
            .ReplaceScoped(serviceType, implementationType)
            .ConfigureSerializer(b => b.AddJsonType(keyType).AddJsonType(valueType));
            return(builder);
        }
Пример #2
0
 /// <summary>
 ///     Adds MongoDB storage of <typeparamref name="TValue"/> value type with <typeparamref name="TKey"/> key type
 ///     including value change history.
 /// </summary>
 public static StorageBuilder AddMongoHistorical <TKey, TValue>(this StorageBuilder builder) => builder
 .AddMongoHistorical(typeof(TKey), typeof(TValue));