Class
InMemoryFlowDocumentRepository

Repository for multi-document orchestration scenarios. Manages multiple flow documents in memory with support for creation and import.

Definition

Namespace:Telerik.Documents.AI.Tools.Flow.Core

Assembly:Telerik.Documents.AI.Tools.Flow.Core.dll

Syntax:

cs-api-definition
public sealed class InMemoryFlowDocumentRepository : InMemoryDocumentRepositoryBase<RadFlowDocument>, IFlowDocumentRepository, IDocumentRepository<RadFlowDocument>, IDocumentRepository, ISupportPdfExport

Inheritance: objectInMemoryDocumentRepositoryBase<RadFlowDocument>InMemoryFlowDocumentRepository

Implements: IDocumentRepositoryIDocumentRepository<RadFlowDocument>IFlowDocumentRepositoryISupportPdfExport

Inherited Members InMemoryDocumentRepositoryBase<RadFlowDocument>.GetDocument(string)InMemoryDocumentRepositoryBase<RadFlowDocument>.GetDocumentAsObject(string)InMemoryDocumentRepositoryBase<RadFlowDocument>.ListDocuments()InMemoryDocumentRepositoryBase<RadFlowDocument>.RemoveDocument(string)InMemoryDocumentRepositoryBase<RadFlowDocument>.Clear()InMemoryDocumentRepositoryBase<RadFlowDocument>.SupportsCreationInMemoryDocumentRepositoryBase<RadFlowDocument>.SupportsMultipleDocuments

Constructors

InMemoryFlowDocumentRepository(TimeSpan?)

Initializes a new instance with no documents.

Declaration

cs-api-definition
public InMemoryFlowDocumentRepository(TimeSpan? importTimeout)

Parameters

importTimeout

TimeSpan?

Timeout for import operations, or null to allow unlimited time.

Properties

DefaultFormat

Gets the default format for documents created by this repository.

Declaration

cs-api-definition
protected override DocumentFormat DefaultFormat { get; }

Property Value

DocumentFormat

Overrides InMemoryDocumentRepositoryBase<RadFlowDocument>.DefaultFormat

DefaultNewDocumentBaseName

Gets the default base name for newly created documents.

Declaration

cs-api-definition
protected override string DefaultNewDocumentBaseName { get; }

Property Value

string

Overrides InMemoryDocumentRepositoryBase<RadFlowDocument>.DefaultNewDocumentBaseName

DocumentType

Gets the document type managed by this repository.

Declaration

cs-api-definition
public override DocumentType DocumentType { get; }

Property Value

DocumentType

Overrides InMemoryDocumentRepositoryBase<RadFlowDocument>.DocumentType

Implements IDocumentRepository.DocumentType

Methods

CreateDocument(string, string[])

Creates a document using the specified document identifier and arguments.

Declaration

cs-api-definition
public string CreateDocument(string documentId, string[] args)

Parameters

documentId

string

The unique identifier for the document to be created. Cannot be null or empty.

args

string[]

An array of arguments used to populate or configure the document. Cannot be null.

Returns

string

A string containing the contents of the created document.

Implements IDocumentRepository.CreateDocument(string, string[])

Export(string, DocumentFormat, Stream)

Exports a document to a byte array in the specified format.

Declaration

cs-api-definition
public void Export(string documentId, DocumentFormat format, Stream destinationStream)

Parameters

documentId

string

The document identifier to export. If null, exports the default/current document.

format

DocumentFormat

The target format for export.

destinationStream

Stream

The stream to which the document will be exported.

Exceptions

NotSupportedException

Thrown when the specified format is not supported.

KeyNotFoundException

Thrown when the specified document ID does not exist.

Implements IDocumentRepository.Export(string, DocumentFormat, Stream)

ExportToPdf(string, Stream)

Exports the specified document to PDF format and writes the result to the provided stream.

Declaration

cs-api-definition
public void ExportToPdf(string documentId, Stream destinationStream)

Parameters

documentId

string

The unique identifier of the document to export. Cannot be null or empty.

destinationStream

Stream

The stream to which the generated PDF will be written. Must be writable and remain open for the duration of the operation.

Implements ISupportPdfExport.ExportToPdf(string, Stream)

Import(Stream, DocumentFormat, string)

Imports a document from a byte array and adds it to the repository.

Declaration

cs-api-definition
public string Import(Stream data, DocumentFormat format, string documentName = null)

Parameters

data

Stream

The document content as a byte array.

format

DocumentFormat

The format of the document being imported.

documentName

string

Optional name for the imported document.

Returns

string

The document ID assigned to the imported document.

Exceptions

NotSupportedException

Thrown when the repository does not support creation or the format is not supported.

Implements IDocumentRepository.Import(Stream, DocumentFormat, string)

MergeAndExport(string[], Stream, DocumentFormat)

Merges the specified source documents and exports the combined result to the provided stream in the specified format.

Declaration

cs-api-definition
public void MergeAndExport(string[] sourceFileIds, Stream stream, DocumentFormat exportFormat)

Parameters

sourceFileIds

string[]

An array of identifiers for the source documents to merge. The order of identifiers determines the order in which documents are merged. Cannot be null or empty.

stream

Stream

The stream to which the merged document will be written. Must be writable and remain open for the duration of the operation.

exportFormat

DocumentFormat

The format in which to export the merged document.

Implements IDocumentRepository.MergeAndExport(string[], Stream, DocumentFormat)