Aiursoft.DbTools.InMemory 8.0.9
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.
Showing the top 20 packages that depend on Aiursoft.DbTools.InMemory.
Packages | Downloads |
---|---|
Aiursoft.SDK
The base class, tools and extends for Aiursoft web apps.
|
218 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
40 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
37 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
36 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
35 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
33 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
29 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
26 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
25 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
23 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
22 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
18 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
13 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
12 |
Aiursoft.DbTools.Switchable
Nuget package of 'Switchable' provided by Aiursoft
|
11 |
Aiursoft.SDK
The base class, tools and extends for Aiursoft web apps.
|
11 |
Aiursoft.SDK
The base class, tools and extends for Aiursoft web apps.
|
9 |
.NET 8.0
- Aiursoft.DbTools (>= 8.0.9)
- Microsoft.EntityFrameworkCore.InMemory (>= 8.0.7)
Version | Downloads | Last updated |
---|---|---|
8.0.13 | 172 | 11/13/2024 |
8.0.12 | 186 | 10/15/2024 |
8.0.11 | 86 | 10/09/2024 |
8.0.10 | 59 | 08/18/2024 |
8.0.9 | 72 | 07/10/2024 |
8.0.8 | 11 | 07/07/2024 |
8.0.7 | 24 | 06/29/2024 |
8.0.6 | 28 | 06/05/2024 |
8.0.5 | 44 | 05/16/2024 |
8.0.4 | 37 | 05/04/2024 |
8.0.3 | 77 | 03/25/2024 |
8.0.2 | 6 | 03/31/2024 |
8.0.1 | 4 | 04/28/2024 |
8.0.0 | 129 | 03/25/2024 |
7.0.19 | 12 | 04/11/2024 |
7.0.18 | 5 | 04/28/2024 |
7.0.17 | 4 | 04/28/2024 |
7.0.16 | 7 | 04/28/2024 |
7.0.15 | 5 | 04/28/2024 |
7.0.14 | 5 | 04/28/2024 |
7.0.13 | 4 | 04/28/2024 |
7.0.12 | 215 | 03/26/2024 |
7.0.11 | 7 | 04/28/2024 |
7.0.10 | 6 | 04/28/2024 |
7.0.9 | 5 | 04/28/2024 |
7.0.8 | 6 | 04/28/2024 |
7.0.7 | 4 | 04/28/2024 |
7.0.6 | 7 | 04/17/2024 |
7.0.5 | 7 | 04/17/2024 |
7.0.4 | 6 | 04/28/2024 |
7.0.3 | 5 | 04/28/2024 |
7.0.2 | 5 | 04/28/2024 |
7.0.1 | 4 | 04/28/2024 |
7.0.0 | 13 | 04/06/2024 |
6.0.32 | 10 | 04/28/2024 |
6.0.31 | 5 | 04/28/2024 |
6.0.30 | 4 | 04/28/2024 |
6.0.29 | 7 | 04/28/2024 |