Aiursoft.DbTools.MySql 8.0.28

There is a newer version of this package available.
See the version list below for details.
dotnet add package Aiursoft.DbTools.MySql --version 8.0.28
                    
NuGet\Install-Package Aiursoft.DbTools.MySql -Version 8.0.28
                    
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="Aiursoft.DbTools.MySql" Version="8.0.28" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aiursoft.DbTools.MySql" Version="8.0.28" />
                    
Directory.Packages.props
<PackageReference Include="Aiursoft.DbTools.MySql" />
                    
Project file
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 Aiursoft.DbTools.MySql --version 8.0.28
                    
#r "nuget: Aiursoft.DbTools.MySql, 8.0.28"
                    
#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 Aiursoft.DbTools.MySql@8.0.28
                    
#: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=Aiursoft.DbTools.MySql&version=8.0.28
                    
Install as a Cake Addin
#tool nuget:?package=Aiursoft.DbTools.MySql&version=8.0.28
                    
Install as a Cake Tool

DBTools

MIT licensed Pipeline stat Test Coverage NuGet version (Aiursoft.CSTools) ManHours

DbTools are Aiursoft's common database tools. It contains a lot of useful database tools for developers.

Installation

To install Aiursoft.DbTools to your project from nuget.org:

dotnet add package Aiursoft.DbTools

Usage

Easier to register DbContext:

SQLite

var services = new ServiceCollection();
services.AddAiurSqliteWithCache<MyDbContext>("Data Source=app.db");

var built = services.BuildServiceProvider();
var context = built.GetRequiredService<MyDbContext>();

SQL Server

var services = new ServiceCollection();
services.AddAiurSqlServerWithCache<MyDbContext>("Server=(localdb)\\mssqllocaldb;Database=DebugTrusted_Connection=True;MultipleActiveResultSets=true");

var built = services.BuildServiceProvider();
var context = built.GetRequiredService<MyDbContext>();

Easier to update database:

var hostBuilder = Host.CreateDefaultBuilder();
hostBuilder.ConfigureServices(services => 
    services.AddAiurSqliteWithCache<MyDbContext>(@"DataSource=app.db;Cache=Shared")
);
var host = hostBuilder.Build();

// Now update:
await host.UpdateDbAsync<MyDbContext>(UpdateMode.CreateThenUse);

Switchable database

Supports:

  • Sqlite
  • MySql
  • InMemory

First, install the package:

dotnet add package Aiursoft.DbTools.Switchable

In your appsettings.json:

{
  // Database.
  "ConnectionStrings": {
    "AllowCache": "True",
    "DbType": "Sqlite",
    "DefaultConnection": "DataSource=app.db;Cache=Shared"
  },
}

In your startup.cs:

var connectionString = configuration.GetConnectionString("DefaultConnection");
var dbType = configuration.GetSection("ConnectionStrings:DbType").Get<DbType>();
var allowCache = configuration.GetSection("ConnectionStrings:AllowCache").Get<bool>();
services.AddDatabase<MyDbContext>(connectionString, dbType, allowCache);

Tips

If your database project is different with your web project, you may need the following command to generate migrations:

cd ./DatabaseProject
dotnet ef migrations add MigrationName --context YourContext --output-dir Migrations --startup-project ../WebProject
dotnet ef database update --context YourContext

How to contribute

There are many ways to contribute to the project: logging bugs, submitting pull requests, reporting issues, and creating suggestions.

Even if you with push rights on the repository, you should create a personal fork and create feature branches there when you need them. This keeps the main repository clean and your workflow cruft out of sight.

We're also interested in your feedback on the future of this project. You can submit a suggestion or feature request through the issue tracker. To make this process more effective, we're asking that these include more information to help define them more clearly.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  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.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Aiursoft.DbTools.MySql:

Package Downloads
Aiursoft.BaGet.Database.MySql

Package Description

Aiursoft.GptGateway.MySql

Package Description

Aiursoft.Kahla.MySql

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Aiursoft.DbTools.MySql:

Repository Stars
AiursoftWeb/Kahla
Kahla is a cross-platform business messaging app. Mirror of https://gitlab.aiursoft.cn/aiursoft/kahla
Version Downloads Last Updated
9.0.24 36 9/6/2025
9.0.23 114 9/4/2025
9.0.22 133 8/18/2025
9.0.21 207 8/5/2025
9.0.20 134 7/9/2025
9.0.19 124 6/30/2025
9.0.18 282 6/11/2025
9.0.17 94 6/1/2025
9.0.16 157 5/1/2025
9.0.15 195 4/16/2025
9.0.14 156 4/9/2025
9.0.13 162 4/7/2025
9.0.12 218 3/12/2025
9.0.11 152 2/27/2025
9.0.10 102 2/27/2025
9.0.9 104 2/25/2025
9.0.8 104 2/23/2025
9.0.7 122 2/12/2025
9.0.6 121 2/1/2025
9.0.5 105 1/16/2025
9.0.4 73 1/15/2025
9.0.3 66 1/15/2025
9.0.2 81 1/14/2025
9.0.1 139 1/1/2025
9.0.0 101 12/30/2024
8.0.29 160 12/11/2024
8.0.28 177 11/14/2024
8.0.27 138 11/13/2024
8.0.25 145 11/9/2024
8.0.24 160 10/26/2024
8.0.23 163 10/14/2024
8.0.22 147 10/9/2024
8.0.21 149 9/29/2024
8.0.20 143 9/28/2024
8.0.19 141 9/22/2024
8.0.18 179 8/22/2024
8.0.17 157 8/18/2024
8.0.16 138 7/23/2024
8.0.15 135 7/10/2024
8.0.14 147 7/7/2024
8.0.13 170 6/29/2024
8.0.12 141 6/5/2024
8.0.11 145 5/28/2024
8.0.10 155 5/16/2024
8.0.9 164 5/4/2024
8.0.8 161 4/6/2024
8.0.7 156 3/31/2024
8.0.6 150 3/31/2024
8.0.5 160 3/17/2024
8.0.4 146 3/17/2024
8.0.3 159 3/3/2024
8.0.2 148 2/28/2024
8.0.1 147 2/25/2024
8.0.0 150 2/19/2024
7.0.24 163 2/14/2024
7.0.23 153 2/4/2024
7.0.22 140 2/2/2024
7.0.21 145 2/2/2024
7.0.20 144 1/30/2024
7.0.19 147 1/27/2024
7.0.18 160 1/21/2024
7.0.17 155 1/10/2024
7.0.16 154 1/4/2024
7.0.15 162 12/30/2023
7.0.14 175 12/24/2023
7.0.13 180 12/12/2023
7.0.12 170 12/12/2023
7.0.11 170 12/1/2023
7.0.10 156 11/26/2023
7.0.9 160 11/18/2023
7.0.8 156 11/12/2023
7.0.7 176 11/2/2023
7.0.6 157 11/2/2023
7.0.5 158 11/1/2023
7.0.4 165 10/31/2023
7.0.3 173 10/27/2023
7.0.2 164 10/18/2023
7.0.1 168 10/11/2023
7.0.0 188 9/5/2023
6.0.32 207 8/4/2023
6.0.31 205 8/3/2023
6.0.30 219 7/11/2023
6.0.29 210 6/30/2023