Table of Contents

Class SinkRegistry

Namespace
Datafication.Server.Core.Registry
Assembly
Datafication.Server.Core.dll

Implementation of ISinkRegistry that manages sink types with dependency injection support.

public class SinkRegistry : ISinkRegistry
Inheritance
object
SinkRegistry
Implements

Constructors

SinkRegistry(IServiceProvider)

Initializes a new instance of the SinkRegistry class.

public SinkRegistry(IServiceProvider serviceProvider)

Parameters

serviceProvider IServiceProvider

The service provider for dependency injection.

Methods

CreateSink(string, Dictionary<string, object>?)

Creates a sink instance using the registered type.

public object? CreateSink(string sinkKey, Dictionary<string, object>? sinkOptions = null)

Parameters

sinkKey string

The sink key identifier.

sinkOptions Dictionary<string, object>

Optional configuration options to apply to the sink.

Returns

object

The sink instance if found; otherwise, null.

GetContentType(string)

Gets the appropriate HTTP content type for the specified sink.

public string GetContentType(string sinkKey)

Parameters

sinkKey string

The sink key identifier.

Returns

string

The content type string if determined; otherwise, "application/octet-stream".

GetRegisteredSinkKeys()

Gets all registered sink keys.

public IEnumerable<string> GetRegisteredSinkKeys()

Returns

IEnumerable<string>

A collection of all registered sink keys.

GetSinkReturnType(string)

Gets the return type of the specified sink.

public Type? GetSinkReturnType(string sinkKey)

Parameters

sinkKey string

The sink key identifier.

Returns

Type

The return type of the sink if found; otherwise, null.

IsSinkRegistered(string)

Checks if a sink with the specified key is registered.

public bool IsSinkRegistered(string sinkKey)

Parameters

sinkKey string

The sink key identifier.

Returns

bool

True if the sink is registered; otherwise, false.

RegisterSink<TSink>(string)

Registers a sink type for a specific sink key.

public void RegisterSink<TSink>(string sinkKey) where TSink : class

Parameters

sinkKey string

The identifier for the sink type (e.g., "pdf", "excel").

Type Parameters

TSink

The type of the sink.

TransformAsync(string, DataBlock, Dictionary<string, object>?)

Transforms a DataBlock using the specified sink with optional configuration.

public Task<object> TransformAsync(string sinkKey, DataBlock dataBlock, Dictionary<string, object>? sinkOptions = null)

Parameters

sinkKey string

The sink key identifier.

dataBlock DataBlock

The DataBlock to transform.

sinkOptions Dictionary<string, object>

Optional configuration options to apply to the sink.

Returns

Task<object>

A task representing the asynchronous operation with the transformation result.