Cchsille.Any.Database
1.1.0
dotnet add package Cchsille.Any.Database --version 1.1.0
NuGet\Install-Package Cchsille.Any.Database -Version 1.1.0
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="Cchsille.Any.Database" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cchsille.Any.Database" Version="1.1.0" />
<PackageReference Include="Cchsille.Any.Database" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cchsille.Any.Database --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Cchsille.Any.Database, 1.1.0"
#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.
#:package Cchsille.Any.Database@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cchsille.Any.Database&version=1.1.0
#tool nuget:?package=Cchsille.Any.Database&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
How to use
Descriptions
AnyDatabase.SQLite.SQLiteAccessor is a class that provides an easy way to access SQLite databases. It supports both synchronous and asynchronous operations, allowing you to execute SQL commands and queries with or without parameters.
This project is use Microsoft.Data.Sqlite as a database driver, which is a lightweight and efficient library for SQLite database access in .NET applications.
Code Example
▼ MyDatabase.cs
using System.Text;
using AnyDatabase.SQLite;
using ReadMe.Database.Entity;
namespace ReadMe.Database;
internal class MyDatabase : IDisposable
{
private readonly SQLiteAccessor _accessor;
private MyDatabase(string filePath, string password)
{
_accessor = new SQLiteAccessor(filePath, password);
}
public static MyDatabase Open()
{
var instance = new MyDatabase("MyDatabase.db", "Pass1234");
instance._accessor.Open();
return instance;
}
public IReadOnlyList<User> GetUser(string userId)
{
var sb = new StringBuilder();
sb.AppendLine("SELECT C_USER_ID ");
sb.AppendLine(" ,C_USER_NAME ");
sb.AppendLine(" ,C_MAIL_ADDRESS ");
sb.AppendLine(" FROM M_USER ");
sb.AppendLine(" WHERE C_USER_ID = $UserId ");
var param = new SQLiteBindParameter();
param.SetBindData("$UserId", userId);
return _accessor.ExecuteReader<User>(sb.ToString(), param);
}
public bool InsertUser(User user)
{
var sb = new StringBuilder();
sb.AppendLine("INSERT INTO M_USER ");
sb.AppendLine("( ");
sb.AppendLine(" C_USER_ID ");
sb.AppendLine(" ,C_USER_NAME ");
sb.AppendLine(" ,C_MAIL_ADDRESS ");
sb.AppendLine(") ");
sb.AppendLine("VALUES ");
sb.AppendLine("( ");
sb.AppendLine(" $UserId ");
sb.AppendLine(" ,$UserName ");
sb.AppendLine(" ,$MailAddress ");
sb.AppendLine(") ");
var param = new SQLiteBindParameter();
param.SetBindData("$UserId", user.UserId);
param.SetBindData("$UserName", user.UserName);
param.SetBindData("$MailAddress", user.MailAddress);
return _accessor.ExecuteNonQuery(sb.ToString(), param) > 0;
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
_accessor.Dispose();
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
▼ User.cs
using AnyDatabase;
namespace ReadMe.Database.Entity;
internal class User
{
[Column("C_USER_ID")]
public string? UserId { get; set; }
[Column("C_USER_NAME")]
public string? UserName { get; set; }
[Column("C_MAIL_ADDRESS")]
public string? MailAddress { get; set; }
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.Data.Sqlite (>= 9.0.5)
- System.Collections.Concurrent (>= 4.3.0)
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.1.0 | 160 | 5/31/2025 |