DocumentManagerBase<TDocument> Class
Abstract base class for document managers that provides common functionality for managing documents in memory with automatic cleanup.
Inheritance
Implements
Namespace: Syncfusion.AI.AgentTools.Core
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public abstract class DocumentManagerBase<TDocument> : Object, IDocumentManager where TDocument : class
Type Parameters
| Name | Description |
|---|---|
| TDocument | The type of document managed by this manager. |
Constructors
DocumentManagerBase(Nullable<TimeSpan>)
Initializes a new instance of the DocumentManagerBase<TDocument> class.
Declaration
protected DocumentManagerBase(Nullable<TimeSpan> expirationTime = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Nullable<System.TimeSpan> | expirationTime | Time before documents are automatically cleaned up. Default is 10 minutes. |
Properties
DocumentIdPrefix
Gets the prefix used for generating document IDs (e.g., "doc_", "pdf_", "ppt_").
Declaration
protected abstract string DocumentIdPrefix { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The document ID prefix specific to the document type. |
DocumentType
Gets the document type handled by this manager.
Declaration
public abstract DocumentType DocumentType { get; }
Property Value
| Type |
|---|
| DocumentType |
Methods
CloseDocument(TDocument)
Closes a document and releases its resources.
Declaration
protected abstract void CloseDocument(TDocument document)
Parameters
| Type | Name | Description |
|---|---|---|
| TDocument | document | The document to close. |
CreateDocumentInstance()
Creates a new document instance.
Declaration
protected abstract TDocument CreateDocumentInstance()
Returns
| Type | Description |
|---|---|
| TDocument | A new document of type TDocument. |
ExportDocumentInstance(TDocument, String)
Exports a document to a file path.
Declaration
protected abstract void ExportDocumentInstance(TDocument document, string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| TDocument | document | The document to export. |
| System.String | filePath | The file path to export to. |
ImportDocument(TDocument)
Imports an existing document instance directly into the manager without file I/O. This is useful for scenarios where a document is created programmatically (e.g., from conversions, merges, or other operations) and needs to be stored in the manager.
Declaration
protected string ImportDocument(TDocument document)
Parameters
| Type | Name | Description |
|---|---|---|
| TDocument | document | The document instance to import. |
Returns
| Type | Description |
|---|---|
| System.String | The document ID assigned to the imported document. |
ImportDocumentInstance(String)
Imports a document from a file path.
Declaration
protected abstract TDocument ImportDocumentInstance(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path to import from. |
Returns
| Type | Description |
|---|---|
| TDocument | The imported document. |
ImportDocumentInstance(String, String)
Imports a document from a file path with password support.
Declaration
protected abstract TDocument ImportDocumentInstance(string filePath, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path to import from. |
| System.String | password | Password for encrypted document. |
Returns
| Type | Description |
|---|---|
| TDocument | The imported document. |