Search Results for

    Show / Hide Table of Contents

    Class CsvStorage<T>

    This class provides access to CSV files (charcater separated values) and parses the data into the application-side type T.

    Inheritance
    System.Object
    CsvStorage<T>
    Implements
    IReadable<T>
    IFileWritable<T>
    IWritable<T>
    Namespace: TeleScope.Persistence.Csv
    Assembly: TeleScope.Persistence.Csv.dll
    Syntax
    public class CsvStorage<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

    CsvStorage(String)

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

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

    The specific CSV file that the storage is related to.

    | Improve this Doc View Source

    CsvStorage(CsvStorageSetup)

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

    Declaration
    public CsvStorage(CsvStorageSetup csvSetup)
    Parameters
    Type Name Description
    CsvStorageSetup csvSetup

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

    Properties

    | Improve this Doc View Source

    OnItemRead

    The delegate handles the read operation of a CSV line and returned the targeted internal type.

    Declaration
    public PersistenceHandler<string[], T> OnItemRead { set; }
    Property Value
    Type Description
    PersistenceHandler<System.String[], T>
    | Improve this Doc View Source

    OnItemWrite

    The delegate handles the write operation to a CSV to a string array that represents a line. The input data is the internal type of the storage.

    Declaration
    public PersistenceHandler<T, string[]> OnItemWrite { set; }
    Property Value
    Type Description
    PersistenceHandler<T, System.String[]>
    | 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 CSV 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 CSV 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.
    ☀
    ☾