Aiursoft.DbTools 9.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Aiursoft.DbTools --version 9.0.4
                    
NuGet\Install-Package Aiursoft.DbTools -Version 9.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="Aiursoft.DbTools" Version="9.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aiursoft.DbTools" Version="9.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Aiursoft.DbTools" />
                    
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 --version 9.0.4
                    
#r "nuget: Aiursoft.DbTools, 9.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.
#addin nuget:?package=Aiursoft.DbTools&version=9.0.4
                    
Install Aiursoft.DbTools as a Cake Addin
#tool nuget:?package=Aiursoft.DbTools&version=9.0.4
                    
Install Aiursoft.DbTools 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

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

Package Downloads
Aiursoft.DbTools.SqlServer

A tool for database.

Aiursoft.DbTools.Sqlite

A tool for database.

Aiursoft.DbTools.InMemory

A tool for database.

Aiursoft.DbTools.MySql

A tool for database.

Aiursoft.DbTools.Switchable

Nuget package of 'Switchable' provided by Aiursoft

GitHub repositories (1)

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

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.13 180 13 days ago
9.0.12 259 a month ago
9.0.11 222 2 months ago
9.0.4 165 2 months ago
9.0.3 147 2 months ago
9.0.2 162 3 months ago
9.0.1 142 3 months ago
9.0.0 185 4 months ago
8.0.12 348 5 months ago
8.0.11 390 6 months ago
8.0.10 338 8 months ago
8.0.9 313 9 months ago
8.0.8 172 9 months ago
8.0.7 169 10 months ago
8.0.6 170 6/5/2024
8.0.5 223 5/16/2024
8.0.4 190 5/4/2024
8.0.3 334 3/17/2024
8.0.2 197 3/17/2024
8.0.1 290 2/25/2024
8.0.0 778 2/19/2024
7.0.19 367 2/14/2024
7.0.18 318 2/4/2024
7.0.17 314 2/2/2024
7.0.16 337 2/2/2024
7.0.15 326 1/30/2024
7.0.14 527 1/10/2024
7.0.13 432 1/4/2024
7.0.12 1,255 12/30/2023
7.0.11 436 12/24/2023
7.0.10 608 12/1/2023
7.0.9 640 11/26/2023
7.0.8 701 11/18/2023
7.0.7 546 11/12/2023
7.0.6 602 11/2/2023
7.0.5 496 11/2/2023
7.0.4 614 10/31/2023
7.0.3 510 10/27/2023
7.0.2 678 10/11/2023
7.0.1 800 9/13/2023
7.0.0 754 9/5/2023
6.0.32 652 8/4/2023
6.0.31 695 8/3/2023
6.0.30 673 7/11/2023
6.0.29 916 6/30/2023
6.0.28 735 6/29/2023
6.0.27 598 6/29/2023
6.0.26 659 6/29/2023
6.0.25 573 6/29/2023
6.0.24 683 6/28/2023
6.0.23 673 6/28/2023
6.0.22 878 6/18/2023
6.0.21 844 6/14/2023
6.0.20 818 6/5/2023
6.0.19 863 5/27/2023
6.0.18 807 5/27/2023
6.0.17 840 5/27/2023
6.0.16 792 5/27/2023
6.0.15 795 5/27/2023
6.0.14 823 5/27/2023
6.0.13 826 5/19/2023
6.0.12 841 5/19/2023
6.0.11 830 5/19/2023
6.0.10 836 5/19/2023
6.0.9 783 5/19/2023
6.0.8 826 5/11/2023
6.0.7 2,859 8/4/2022
6.0.6 1,430 7/6/2022
6.0.5 1,730 5/13/2022
6.0.0 1,525 3/27/2022
5.0.9 1,500 5/31/2021
5.0.8 1,372 5/23/2021
5.0.7 1,388 5/7/2021
5.0.6 1,418 4/14/2021
5.0.5 1,517 2/16/2021
5.0.4 1,491 1/29/2021
5.0.3 1,478 1/27/2021
5.0.2 1,572 12/9/2020
5.0.1 1,481 11/30/2020
5.0.0 1,390 11/14/2020
3.2.11 1,672 10/18/2020
3.2.10 1,561 10/3/2020
3.2.9 1,533 10/2/2020
3.2.8 1,608 9/10/2020
3.2.7 1,591 9/2/2020
3.2.6 1,620 8/12/2020
3.2.5 1,652 7/31/2020
3.2.4 1,681 7/3/2020
3.2.3 1,583 6/25/2020
3.2.2 1,610 6/18/2020
3.2.1 1,580 6/5/2020
3.2.0 1,683 6/4/2020
3.1.14 1,776 6/4/2020
3.1.13 1,796 5/25/2020
3.1.12 1,678 5/20/2020
3.1.11 1,655 5/18/2020
3.1.10 1,694 5/18/2020
3.1.9 1,662 5/17/2020
3.1.8 1,684 5/12/2020
3.1.7 1,730 5/2/2020
3.1.6 1,755 5/1/2020
3.1.5 1,753 4/21/2020
3.1.4 1,484 4/19/2020