Aiursoft.DbTools.SqlServer
8.0.27
dotnet add package Aiursoft.DbTools.SqlServer --version 8.0.27
NuGet\Install-Package Aiursoft.DbTools.SqlServer -Version 8.0.27
<PackageReference Include="Aiursoft.DbTools.SqlServer" Version="8.0.27" />
paket add Aiursoft.DbTools.SqlServer --version 8.0.27
#r "nuget: Aiursoft.DbTools.SqlServer, 8.0.27"
// Install Aiursoft.DbTools.SqlServer as a Cake Addin #addin nuget:?package=Aiursoft.DbTools.SqlServer&version=8.0.27 // Install Aiursoft.DbTools.SqlServer as a Cake Tool #tool nuget:?package=Aiursoft.DbTools.SqlServer&version=8.0.27
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.DbTools (>= 8.0.12)
- EFCoreSecondLevelCacheInterceptor (>= 4.8.8)
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.11)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Aiursoft.DbTools.SqlServer:
Package | Downloads |
---|---|
Aiursoft.SDK
The base class, tools and extends for Aiursoft web apps. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Aiursoft.DbTools.SqlServer:
Repository | Stars |
---|---|
AiursoftWeb/Infrastructures
Mirror of: https://gitlab.aiursoft.cn/aiursoft/infrastructures
|
Version | Downloads | Last updated |
---|---|---|
8.0.27 | 65 | 11/14/2024 |
8.0.26 | 67 | 11/13/2024 |
8.0.24 | 70 | 11/9/2024 |
8.0.23 | 75 | 10/26/2024 |
8.0.22 | 77 | 10/14/2024 |
8.0.21 | 83 | 10/9/2024 |
8.0.20 | 86 | 9/29/2024 |
8.0.19 | 78 | 9/28/2024 |
8.0.18 | 89 | 9/22/2024 |
8.0.17 | 134 | 8/22/2024 |
8.0.16 | 118 | 8/18/2024 |
8.0.15 | 89 | 7/23/2024 |
8.0.14 | 96 | 7/10/2024 |
8.0.13 | 105 | 7/7/2024 |
8.0.12 | 104 | 6/29/2024 |
8.0.11 | 93 | 6/5/2024 |
8.0.10 | 102 | 5/28/2024 |
8.0.9 | 115 | 5/16/2024 |
8.0.8 | 121 | 5/4/2024 |
8.0.7 | 118 | 4/6/2024 |
8.0.6 | 120 | 3/31/2024 |
8.0.5 | 113 | 3/31/2024 |
8.0.4 | 102 | 3/17/2024 |
8.0.3 | 114 | 3/17/2024 |
8.0.2 | 134 | 3/3/2024 |
8.0.1 | 129 | 2/25/2024 |
8.0.0 | 376 | 2/19/2024 |
7.0.25 | 134 | 2/14/2024 |
7.0.24 | 115 | 2/4/2024 |
7.0.23 | 106 | 2/2/2024 |
7.0.22 | 97 | 2/2/2024 |
7.0.21 | 105 | 1/30/2024 |
7.0.20 | 110 | 1/27/2024 |
7.0.19 | 130 | 1/21/2024 |
7.0.18 | 134 | 1/10/2024 |
7.0.17 | 130 | 1/4/2024 |
7.0.16 | 834 | 12/30/2023 |
7.0.15 | 152 | 12/24/2023 |
7.0.14 | 147 | 12/12/2023 |
7.0.13 | 127 | 12/12/2023 |
7.0.12 | 151 | 12/1/2023 |
7.0.11 | 311 | 11/26/2023 |
7.0.10 | 336 | 11/18/2023 |
7.0.9 | 205 | 11/12/2023 |
7.0.8 | 262 | 11/2/2023 |
7.0.7 | 154 | 11/2/2023 |
7.0.6 | 176 | 11/1/2023 |
7.0.5 | 200 | 10/31/2023 |
7.0.4 | 168 | 10/27/2023 |
7.0.3 | 206 | 10/18/2023 |
7.0.2 | 235 | 10/11/2023 |
7.0.1 | 390 | 9/13/2023 |
7.0.0 | 294 | 9/5/2023 |
6.0.32 | 219 | 8/4/2023 |
6.0.31 | 181 | 8/3/2023 |
6.0.30 | 197 | 7/11/2023 |
6.0.29 | 428 | 6/30/2023 |