Search Results for

    Show / Hide Table of Contents

    Class YamlStorage<T>

    This class provides access to YAML files and parses the data into the application-side type T.

    Inheritance
    System.Object
    YamlStorage<T>
    Implements
    IReadable<T>
    IFileWritable<T>
    IWritable<T>
    Namespace: TeleScope.Persistence.Yaml
    Assembly: TeleScope.Persistence.Yaml.dll
    Syntax
    public class YamlStorage<T> : object, IReadable<T>, IFileWritable<T>, IWritable<T>
    Type Parameters
    Name Description
    T

    The type T is used application-side and can be read from the data source or be written to the data sink.

    Constructors

    | Improve this Doc View Source

    YamlStorage(String)

    The constructor takes the file string as input parameter, creates the YamlStorageSetup and allows to config the properties afterwards.

    Declaration
    public YamlStorage(string file)
    Parameters
    Type Name Description
    System.String file

    The specific YAML file that the storage is related to.

    | Improve this Doc View Source

    YamlStorage(YamlStorageSetup)

    The constructor takes the setup of type YamlStorageSetup as input parameter and binds the logging mechanism.

    Declaration
    public YamlStorage(YamlStorageSetup yamlSetup)
    Parameters
    Type Name Description
    YamlStorageSetup yamlSetup

    The setup is needed to work with a specific YAML file.

    Properties

    | Improve this Doc View Source

    Permissions

    Gets the flags of permissions how files may be treated.

    Declaration
    public WritePermissions Permissions { get; }
    Property Value
    Type Description
    WritePermissions

    Methods

    | Improve this Doc View Source

    HasPermission(WritePermissions)

    Checks if the permission is a present flag or not.

    Declaration
    public bool HasPermission(WritePermissions permission)
    Parameters
    Type Name Description
    WritePermissions permission

    The enum that is checked.

    Returns
    Type Description
    System.Boolean

    True if the value is a present flag, otherwise false.

    | Improve this Doc View Source

    Read()

    Reads a given YAML file as data source and provides a collection of type T. If there is only one data object a collection with the length one is returned.

    Declaration
    public IEnumerable<T> Read()
    Returns
    Type Description
    IEnumerable<T>

    The resulting data objects of type T.

    | Improve this Doc View Source

    Update(FileInfo)

    Updates the reference to the internal instance so that the data sink can be updated.

    Declaration
    public IFileWritable<T> Update(FileInfo fileInfo)
    Parameters
    Type Name Description
    FileInfo fileInfo

    The new FileInfo object.

    Returns
    Type Description
    IFileWritable<T>

    The calling instance.

    | Improve this Doc View Source

    Update(String)

    Updates the reference to the internal instance so that the data sink can be updated.

    Declaration
    public IFileWritable<T> Update(string file)
    Parameters
    Type Name Description
    System.String file

    The new string of the file.

    Returns
    Type Description
    IFileWritable<T>

    The calling instance.

    | Improve this Doc View Source

    Write(IEnumerable<T>)

    Writes a collection of type T to a YAML file as data sink. If there is only one data object there is the need to provide a collection with one element.

    Declaration
    public void Write(IEnumerable<T> data)
    Parameters
    Type Name Description
    IEnumerable<T> data

    The application-side data collection of type T.

    Implements

    IReadable<T>
    IFileWritable<T>
    IWritable<T>
    • GITHUB
    • Improve this Doc
    • View Source
    ☀
    ☾
    In This Article
    Back to top
    Copyright 2020-2022 TeleScope-dotnet. Generated by DocFX.
    ☀
    ☾