Table of Contents

Class DistributedCacheSerializerServiceExtensions

Namespace
Acuit.Pinpoint.ResourceManagement
Assembly
Acuit.Pinpoint.ResourceManagement.Abstractions.dll

Extensions for IServiceProvider for working with distributed cache serializers.

public static class DistributedCacheSerializerServiceExtensions
Inheritance
DistributedCacheSerializerServiceExtensions
Inherited Members

Methods

GetDistributedCacheSerializer<T>(IServiceProvider)

Gets the IDistributedCacheSerializer<T> registered for the provided type T.

public static IDistributedCacheSerializer<T> GetDistributedCacheSerializer<T>(this IServiceProvider serviceProvider) where T : notnull

Parameters

serviceProvider IServiceProvider

Returns

IDistributedCacheSerializer<T>

The IDistributedCacheSerializer<T>.

Type Parameters

T

The type to be serialized.

Remarks

If there is a IDistributedCacheSerializer<T> for T available from serviceProvider, it will be selected. Otherwise, if there is an IDistributedCacheSerializerFactory available, it will be used to try to create a serializer for T.

Exceptions

InvalidOperationException

No IDistributedCacheSerializer<T> is configured for type T.

TryGetDistributedCacheSerializer<T>(IServiceProvider, out IDistributedCacheSerializer<T>?)

Tries to gets the IDistributedCacheSerializer<T> registered for the provided type T.

public static bool TryGetDistributedCacheSerializer<T>(this IServiceProvider serviceProvider, out IDistributedCacheSerializer<T>? serializer) where T : notnull

Parameters

serviceProvider IServiceProvider
serializer IDistributedCacheSerializer<T>

On return, the IDistributedCacheSerializer<T>, or null if one was not found for T.

Returns

bool

true if the serializer was found; otherwise, false.

Type Parameters

T

The type to be serialized.

Remarks

If there is a IDistributedCacheSerializer<T> for T available from serviceProvider, it will be selected. Otherwise, if there is an IDistributedCacheSerializerFactory available, it will be used to try to create a serializer for T.