TextDatabase 1.0.2
See the version list below for details.
dotnet add package TextDatabase --version 1.0.2
NuGet\Install-Package TextDatabase -Version 1.0.2
<PackageReference Include="TextDatabase" Version="1.0.2" />
paket add TextDatabase --version 1.0.2
#r "nuget: TextDatabase, 1.0.2"
// Install TextDatabase as a Cake Addin #addin nuget:?package=TextDatabase&version=1.0.2 // Install TextDatabase as a Cake Tool #tool nuget:?package=TextDatabase&version=1.0.2
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 | Versions 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. |
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
GetAsync<T>() issue.