Aiursoft.DbTools
8.0.8
See the version list below for details.
dotnet add package Aiursoft.DbTools --version 8.0.8
NuGet\Install-Package Aiursoft.DbTools -Version 8.0.8
<PackageReference Include="Aiursoft.DbTools" Version="8.0.8" />
paket add Aiursoft.DbTools --version 8.0.8
#r "nuget: Aiursoft.DbTools, 8.0.8"
// Install Aiursoft.DbTools as a Cake Addin #addin nuget:?package=Aiursoft.DbTools&version=8.0.8 // Install Aiursoft.DbTools as a Cake Tool #tool nuget:?package=Aiursoft.DbTools&version=8.0.8
DBTools
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 | Versions 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. |
-
net8.0
- Aiursoft.CSTools (>= 8.0.4)
- Microsoft.EntityFrameworkCore.Relational (>= 8.0.6)
- Microsoft.Extensions.Hosting (>= 8.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Aiursoft.DbTools:
Package | Downloads |
---|---|
Aiursoft.DbTools.SqlServer
A tool for database. |
|
Aiursoft.DbTools.InMemory
A tool for database. |
|
Aiursoft.DbTools.Sqlite
A tool for database. |
|
Aiursoft.DbTools.MySql
A tool for database. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.11 | 316 | 10/9/2024 |
8.0.10 | 316 | 8/18/2024 |
8.0.9 | 284 | 7/10/2024 |
8.0.8 | 140 | 7/7/2024 |
8.0.7 | 140 | 6/29/2024 |
8.0.6 | 146 | 6/5/2024 |
8.0.5 | 199 | 5/16/2024 |
8.0.4 | 166 | 5/4/2024 |
8.0.3 | 312 | 3/17/2024 |
8.0.2 | 175 | 3/17/2024 |
8.0.1 | 268 | 2/25/2024 |
8.0.0 | 579 | 2/19/2024 |
7.0.19 | 325 | 2/14/2024 |
7.0.18 | 297 | 2/4/2024 |
7.0.17 | 291 | 2/2/2024 |
7.0.16 | 316 | 2/2/2024 |
7.0.15 | 303 | 1/30/2024 |
7.0.14 | 506 | 1/10/2024 |
7.0.13 | 409 | 1/4/2024 |
7.0.12 | 1,092 | 12/30/2023 |
7.0.11 | 415 | 12/24/2023 |
7.0.10 | 590 | 12/1/2023 |
7.0.9 | 623 | 11/26/2023 |
7.0.8 | 682 | 11/18/2023 |
7.0.7 | 530 | 11/12/2023 |
7.0.6 | 585 | 11/2/2023 |
7.0.5 | 478 | 11/2/2023 |
7.0.4 | 595 | 10/31/2023 |
7.0.3 | 493 | 10/27/2023 |
7.0.2 | 660 | 10/11/2023 |
7.0.1 | 784 | 9/13/2023 |
7.0.0 | 738 | 9/5/2023 |
6.0.32 | 637 | 8/4/2023 |
6.0.31 | 679 | 8/3/2023 |
6.0.30 | 654 | 7/11/2023 |
6.0.29 | 902 | 6/30/2023 |
6.0.28 | 722 | 6/29/2023 |
6.0.27 | 584 | 6/29/2023 |
6.0.26 | 644 | 6/29/2023 |
6.0.25 | 558 | 6/29/2023 |
6.0.24 | 667 | 6/28/2023 |
6.0.23 | 660 | 6/28/2023 |
6.0.22 | 861 | 6/18/2023 |
6.0.21 | 822 | 6/14/2023 |
6.0.20 | 798 | 6/5/2023 |
6.0.19 | 842 | 5/27/2023 |
6.0.18 | 787 | 5/27/2023 |
6.0.17 | 818 | 5/27/2023 |
6.0.16 | 769 | 5/27/2023 |
6.0.15 | 776 | 5/27/2023 |
6.0.14 | 802 | 5/27/2023 |
6.0.13 | 806 | 5/19/2023 |
6.0.12 | 817 | 5/19/2023 |
6.0.11 | 807 | 5/19/2023 |
6.0.10 | 814 | 5/19/2023 |
6.0.9 | 764 | 5/19/2023 |
6.0.8 | 805 | 5/11/2023 |
6.0.7 | 2,831 | 8/4/2022 |
6.0.6 | 1,400 | 7/6/2022 |
6.0.5 | 1,682 | 5/13/2022 |
6.0.0 | 1,492 | 3/27/2022 |
5.0.9 | 1,465 | 5/31/2021 |
5.0.8 | 1,337 | 5/23/2021 |
5.0.7 | 1,349 | 5/7/2021 |
5.0.6 | 1,382 | 4/14/2021 |
5.0.5 | 1,470 | 2/16/2021 |
5.0.4 | 1,451 | 1/29/2021 |
5.0.3 | 1,438 | 1/27/2021 |
5.0.2 | 1,533 | 12/9/2020 |
5.0.1 | 1,432 | 11/30/2020 |
5.0.0 | 1,350 | 11/14/2020 |
3.2.11 | 1,632 | 10/18/2020 |
3.2.10 | 1,522 | 10/3/2020 |
3.2.9 | 1,494 | 10/2/2020 |
3.2.8 | 1,545 | 9/10/2020 |
3.2.7 | 1,542 | 9/2/2020 |
3.2.6 | 1,582 | 8/12/2020 |
3.2.5 | 1,612 | 7/31/2020 |
3.2.4 | 1,642 | 7/3/2020 |
3.2.3 | 1,544 | 6/25/2020 |
3.2.2 | 1,571 | 6/18/2020 |
3.2.1 | 1,539 | 6/5/2020 |
3.2.0 | 1,642 | 6/4/2020 |
3.1.14 | 1,737 | 6/4/2020 |
3.1.13 | 1,753 | 5/25/2020 |
3.1.12 | 1,638 | 5/20/2020 |
3.1.11 | 1,616 | 5/18/2020 |
3.1.10 | 1,650 | 5/18/2020 |
3.1.9 | 1,621 | 5/17/2020 |
3.1.8 | 1,640 | 5/12/2020 |
3.1.7 | 1,689 | 5/2/2020 |
3.1.6 | 1,713 | 5/1/2020 |
3.1.5 | 1,710 | 4/21/2020 |
3.1.4 | 1,442 | 4/19/2020 |