Class DocumentService
Functions to load and store files or images.
public sealed class DocumentService
- Inheritance
-
DocumentService
- Inherited Members
Constructors
DocumentService(IDocumentStore, IServices, ILogger<DocumentService>, ILogger)
Functions to load and store files or images.
public DocumentService(IDocumentStore documentStore, IServices services, ILogger<DocumentService> serviceLogger, ILogger storeLogger)
Parameters
documentStoreIDocumentStoreservicesIServicesserviceLoggerILogger<DocumentService>storeLoggerILogger
Methods
AddAccessRules(IPrincipal?, CancellationToken?, params IReadOnlyList<NewAccessRule>)
public Task AddAccessRules(IPrincipal? principal, CancellationToken? cancellationToken, params IReadOnlyList<NewAccessRule> newRules)
Parameters
principalIPrincipalcancellationTokenCancellationToken?newRulesIReadOnlyList<NewAccessRule>
Returns
CreateFile(Guid, DocumentAccessAssertion)
Access an existing document given its known ID
public FileDocument CreateFile(Guid id, DocumentAccessAssertion access)
Parameters
idGuidaccessDocumentAccessAssertion
Returns
CreateImage(Guid, DocumentAccessAssertion)
Access an existing document given its known ID
public ImageDocument CreateImage(Guid id, DocumentAccessAssertion access)
Parameters
idGuidaccessDocumentAccessAssertion
Returns
UploadFileAsync(Stream, string, string, DocumentAccessRule, bool, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new document from a stream
public Task<FileDocument> UploadFileAsync(Stream data, string originalFilename, string mimeType, DocumentAccessRule rule, bool disposeStream = true, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
dataStreamoriginalFilenamestringmimeTypestringruleDocumentAccessRuledisposeStreamboolprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
This will dispose of the stream you pass in, unless disposeStream:=False is specified.
UploadFileAsync(Stream, string, DocumentAccessRule, bool, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new document from a stream, using a MIME type determined from the filename.
public Task<FileDocument> UploadFileAsync(Stream data, string originalFilename, DocumentAccessRule rule, bool disposeStream = true, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
dataStreamoriginalFilenamestringruleDocumentAccessRuledisposeStreamboolprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
This will dispose of the stream you pass in, unless disposeStream:=False is specified.
UploadFileAsync(string, string, DocumentAccessRule, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new document from the filesystem
public Task<FileDocument> UploadFileAsync(string localPath, string mimeType, DocumentAccessRule rule, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
localPathstringmimeTypestringruleDocumentAccessRuleprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
UploadFileAsync(string, DocumentAccessRule, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new document from the filesystem, using a MIME type determined from the filename
public Task<FileDocument> UploadFileAsync(string localPath, DocumentAccessRule rule, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
localPathstringruleDocumentAccessRuleprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
UploadImageAsync(Stream, string, string, int, int, DocumentAccessRule, bool, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new image from a stream
public Task<ImageDocument> UploadImageAsync(Stream data, string originalFilename, string mimeType, int width, int height, DocumentAccessRule rule, bool disposeStream = true, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
dataStreamoriginalFilenamestringmimeTypestringwidthintheightintruleDocumentAccessRuledisposeStreamboolprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
This will dispose of the stream you pass in, unless disposeStream:=False is specified.
UploadImageAsync(Stream, string, DocumentAccessRule, bool, IPrincipal?, CancellationToken?, IProgress<long>?)
Create a new image from a stream, using a MIME type and dimensions determined from the data.
public Task<ImageDocument> UploadImageAsync(Stream data, string originalFilename, DocumentAccessRule rule, bool disposeStream = true, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
dataStreamoriginalFilenamestringruleDocumentAccessRuledisposeStreamboolprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
This will dispose of the stream you pass in, unless disposeStream:=False is specified. Loads the whole image in order to determine dimensions and MIME type.
UploadImageAsync(string, string, int, int, DocumentAccessRule, IPrincipal?, CancellationToken?, IProgress<long>?)
Store a new image from the filesystem.
public Task<ImageDocument> UploadImageAsync(string localPath, string mimeType, int width, int height, DocumentAccessRule rule, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
localPathstringmimeTypestringwidthintheightintruleDocumentAccessRuleprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
UploadImageAsync(string, DocumentAccessRule, IPrincipal?, CancellationToken?, IProgress<long>?)
Store a new image from the filesystem, using a MIME type and dimensions determined from the data.
public Task<ImageDocument> UploadImageAsync(string localPath, DocumentAccessRule rule, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
localPathstringruleDocumentAccessRuleprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
Loads the whole image in order to determine dimensions and MIME type.
UploadThumbnailAsync(ImageMetadata, Stream, int, int, DocumentAccessAssertion, bool, IPrincipal?, CancellationToken?, IProgress<long>?)
Set the thumbnail for an existing image
public Task<ImageDocument> UploadThumbnailAsync(ImageMetadata thumbnailFor, Stream data, int width, int height, DocumentAccessAssertion access, bool disposeStream = true, IPrincipal? principal = null, CancellationToken? cancellationToken = null, IProgress<long>? progress = null)
Parameters
thumbnailForImageMetadatadataStreamwidthintheightintaccessDocumentAccessAssertiondisposeStreamboolprincipalIPrincipalcancellationTokenCancellationToken?progressIProgress<long>
Returns
Remarks
This will dispose of the stream you pass in, unless disposeStream:=False is specified.