TextDatabase 1.0.4

dotnet add package TextDatabase --version 1.0.4
NuGet\Install-Package TextDatabase -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TextDatabase" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TextDatabase --version 1.0.4
#r "nuget: TextDatabase, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TextDatabase as a Cake Addin
#addin nuget:?package=TextDatabase&version=1.0.4

// Install TextDatabase as a Cake Tool
#tool nuget:?package=TextDatabase&version=1.0.4

Getting Started Getting Started

What is this project about?

TextDatabase is a class library implemented in C#. Contains several methods for the most common interactions between a database and applications in .Net. It can be used in small console and desktop projects.

Dependencies

In current version

  • net7.0
  • Newtonsoft.Json 13.03

How it works?

After installing the Nuget package we will be able to use the FileHandler class. Through this, the most common CRUD operations can be performed.

The product is strongly typed and needs to follow a series of rules for its proper functioning.

  • The database will be created automatically when you call the FileHandler.GetInstance(appName) method. Its location is C:\Users{username}\AppData\Local{appName}
  • The tables will be created with the first Insert and will bear the name of the class that is inserted.
  • All objects to be inserted must belong to classes that inherit from TextDatabase.IAR and will carry an integer Id that will be the primary key and therefore must be unique.
using TextDataBase;
...

CRUD examples

Multiple Insert example
   public async Task InsertListAsyn(List<User> users)
  {
        FileHandler fh = FileHandler.GetInstance("MyApp");
        await fh.InsertListAsync<User>(users);
  }
Get
  public async Task GetUserList()
  {
        FileHandler fh = FileHandler.GetInstance("MyApp");
        await fh.Get<User>();
  }
Update
  public async Task UpdateAsync(User user)
  {
       FileHandler fh = FileHandler.GetInstance("MyApp");
        await fh.UpdateAsync<User>(user);
  }
Delete
  public async Task DeleteAsync(List<User> user)
  {
         FileHandler fh = FileHandler.GetInstance("MyApp");
        await fh.Delete<USser>(users, tableName);
  }

Otros ejemplos

Backup example
     public static bool BackupDatabase(string path)
        {
            try
            {
                DataBaseHandler.CreateBackup("MyApp", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), true);
            }
            catch (Exception ex)
            {
                return false;
            }
            return true;

        }

Summary

Although I have tested thousands of records, we do not consider it a substitute for databases. TextDatabase can work well with a low-complexity structure and a small volume of data. Specifically, when it is required to store temporary or configuration data, etc.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 139 5/5/2023
1.0.3 120 5/5/2023
1.0.2 120 5/5/2023
1.0.1 102 5/4/2023
1.0.0 120 5/4/2023

GetByPropertyValue<T>() handling exception