dotConnect for DB2 is a high-performance ORM enabled data provider for DB2 that builds on ADO.NET technology. The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+. More information at https://www.devart.com/dotconnect/db2/ License dotConnect for DB2 is available in several editions https://www.devart.com/dotconnect/db2/ordering.html The NuGet package initiates the retrieval of an activation key from the Devart website. This key is required to activate the product for a free trial. Key Features * Direct Mode: Allows your application to work with DB2 directly, without additional libraries. * ASP.NET Core: Supports ASP.NET Core Identity. * Performance: Uses many DB2-specific performance features and optimizations to ensure the highest performance. * Monitoring: Allows per-component tracing of database events with a free dbMonitor application. * Security: Supports various encryption SSL and SSH connections, etc. * Support and updates: Enjoy dedicated support team for prompt issue resolution and regular updates to keep your software running smoothly and securely.
$ dotnet add package Devart.Data.DB2.EFCoredotConnect for DB2 is a high-performance ORM enabled data provider for DB2 that builds on ADO.NET technology.
The provider works with .NET Frameworks 2.0+, .NET Core 2.0+, .NET 5+. The product is compatible with ADO.NET Entity Framework (EF) Core.
It also includes visual ORM designer for Entity Framework, Entity Framework Core, and LinqConnect ORM models.
More information at dotConnect for DB2.
For projects, using Entity Framework Core 10 with DB2, install this package. Execute the following command in the Package Manager Console:
Install-Package Devart.Data.DB2.EFCore
For projects that require integration with Entity Framework 6.4 (EF6), use the Devart.Data.DB2.EF6 package.
There also are Visual Studio extensions for earlier Visual Studio versions. If you use some other tool than Visual Studio, you can get NuGet packages with the nuget.exe console tool.
dotConnect for DB2 is available in several editions. See pricing options for ordering.
The NuGet package initiates the retrieval of an activation key from the Devart website. This key is required to activate the product for a free trial.
The following table show which version of this package to use with which version of frameworks.
| Frameworks | Version support |
|---|---|
| Entity Framework Core | 10 |
| .NET | 10 |
More information here
This snippet directly configures a DB2 database connection for an Entity Framework Core DbContext using a connection string.
public class MyDbContext : DbContext {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
optionsBuilder.UseDB2(@"UserId=db2admin;Password=mypassword;Server=db2:50000;Database=SAMPLE");
}
}Configuration Using DB2Connection Instance
using Devart.Data.DB2;
...
public class MyDbContext : DbContext {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
var connection = new DB2Connection();
connection.Server = "db2:50000"
connection.UserId = "db2admin"
connection.Database = "SAMPLE"
connection.Password = "mypassword"
optionsBuilder.UseDB2(connection);
}
}Configuration File (appsettings.json):
{
"ConnectionStrings": {
"DefaultConnection": "UserId=db2admin;Password=mypassword;Server=db2:50000;Database=SAMPLE"
}
}DbContext Configuration:
public class MyDbContext : DbContext {
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
IConfiguration configuration = builder.Build();
optionsBuilder.UseDB2(configuration.GetConnectionString("DefaultConnection"));
}
}For more information about secure connections read at our documentation.