Search Results for

    Show / Hide Table of Contents
    View Source

    Class FileServiceBase<TRepository, TEntity>

    Inheritance
    System.Object
    RepositoryService
    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public abstract class FileServiceBase<TRepository, TEntity> : RepositoryService, IService, IBasicFileService<TEntity> where TRepository : IFileRepository, IReadRepository<string, TEntity> where TEntity : IFile
    Type Parameters
    Name Description
    TRepository
    TEntity

    Constructors

    View Source

    FileServiceBase(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, TRepository)

    Declaration
    public FileServiceBase(ICoreScopeProvider provider, ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, TRepository repository)
    Parameters
    Type Name Description
    ICoreScopeProvider provider
    ILoggerFactory loggerFactory
    IEventMessagesFactory eventMessagesFactory
    TRepository repository

    Properties

    View Source

    AllowedFileExtensions

    Declaration
    protected abstract string[] AllowedFileExtensions { get; }
    Property Value
    Type Description
    System.String[]
    View Source

    Repository

    Declaration
    public TRepository Repository { get; }
    Property Value
    Type Description
    TRepository

    Methods

    View Source

    GetAllAsync(String[])

    Gets all by path, or all if no paths are specified.

    Declaration
    public Task<IEnumerable<TEntity>> GetAllAsync(params string[] paths)
    Parameters
    Type Name Description
    System.String[] paths

    Optional paths of to get.

    Returns
    Type Description
    Task<IEnumerable<TEntity>>

    IEnumerable of

    View Source

    GetAsync(String)

    Gets by path.

    Declaration
    public Task<TEntity> GetAsync(string path)
    Parameters
    Type Name Description
    System.String path

    The path to get from.

    Returns
    Type Description
    Task<TEntity>

    , or null if not found

    View Source

    GetContentStreamAsync(String)

    Get the content of a file as a stream.

    Declaration
    public Task<Stream> GetContentStreamAsync(string path)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Returns
    Type Description
    Task<Stream>

    A stream containing the contents of the file.

    View Source

    GetFileSizeAsync(String)

    Declaration
    public Task<long> GetFileSizeAsync(string path)
    Parameters
    Type Name Description
    System.String path
    Returns
    Type Description
    Task<System.Int64>
    View Source

    HasValidFileExtension(String)

    Declaration
    protected virtual bool HasValidFileExtension(string fileName)
    Parameters
    Type Name Description
    System.String fileName
    Returns
    Type Description
    System.Boolean
    View Source

    HasValidFileName(String)

    Declaration
    protected virtual bool HasValidFileName(string fileName)
    Parameters
    Type Name Description
    System.String fileName
    Returns
    Type Description
    System.Boolean
    View Source

    IsRootPath(String)

    Checks if a path is considered a root path.

    Declaration
    protected virtual bool IsRootPath(string path)
    Parameters
    Type Name Description
    System.String path

    The path to check.

    Returns
    Type Description
    System.Boolean

    True if the path is considered a root path.

    View Source

    SetContentStreamAsync(String, Stream)

    Set the content of a file from a stream.

    Declaration
    public Task SetContentStreamAsync(string path, Stream content)
    Parameters
    Type Name Description
    System.String path

    The path to the file.

    Stream content

    The desired content of the file as a stream.

    Returns
    Type Description
    Task
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • FileServiceBase(ICoreScopeProvider, ILoggerFactory, IEventMessagesFactory, TRepository)
    • Properties
      • AllowedFileExtensions
      • Repository
    • Methods
      • GetAllAsync(String[])
      • GetAsync(String)
      • GetContentStreamAsync(String)
      • GetFileSizeAsync(String)
      • HasValidFileExtension(String)
      • HasValidFileName(String)
      • IsRootPath(String)
      • SetContentStreamAsync(String, Stream)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX