DbFactoryAdapter 1.0.2
Transaction bug fixed in version 1.0.3
See the version list below for details.
dotnet add package DbFactoryAdapter --version 1.0.2
NuGet\Install-Package DbFactoryAdapter -Version 1.0.2
<PackageReference Include="DbFactoryAdapter" Version="1.0.2" />
paket add DbFactoryAdapter --version 1.0.2
#r "nuget: DbFactoryAdapter, 1.0.2"
// Install DbFactoryAdapter as a Cake Addin #addin nuget:?package=DbFactoryAdapter&version=1.0.2 // Install DbFactoryAdapter as a Cake Tool #tool nuget:?package=DbFactoryAdapter&version=1.0.2
DbConnectAdapter
Dbfactory adapter middleware, supports
- Oracle
- MS Sql Server
- Postgres
- MySql
public class DatabaseBase { public IDbContext DbContext; }
public class Database : DatabaseBase { public Database(IConfiguration config, IHost host) { Initialize(config, host); }
private void Initialize(IConfiguration config, IHost host)
{
IConnection conn = new Connection();
config.GetSection("Connection").Bind(conn);
DbContext = ActivatorUtilities.CreateInstance<DbContext>(host.Services, conn);
}
}
appsettings.json file:
''' "Connection": { "DatabaseType": "SQLSERVER", "Server": "0.0.0.0", "DatabaseName": "database", "UserId": "sa", "Password": "***", "Port": 1443, "MaxPoolSize": 0, "ConnectionTimeout": 60, "CommandTimeout": 0 } '''
program.cs file:
''' builder.Services.AddTransient<IConnection, Connection>(); builder.Services.AddTransient<IDbContext, DbContext>(); builder.Services.AddTransient<Database>(); IConfigurationSection ConnectionSection = builder.Configuration.GetSection("Connection"); builder.Services.Configure<IConnection>(ConnectionSection); '''
USESAGE:
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
- Microsoft.Extensions.Options (>= 8.0.0)
- MySql.Data (>= 8.2.0)
- Npgsql (>= 7.0.6)
- Oracle.ManagedDataAccess.Core (>= 3.21.120)
- System.Data.SqlClient (>= 4.8.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.