OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Connector/NET

V1.3.1
  • What Is OceanBase Connector/NET
    • Introduction to OceanBase Connector/NET
  • Install and Connect
    • Installation process
    • Test the connection
    • Package reference and usage
    • Compatibility impact
  • User Guide
    • Quick Start
      • Complete example
    • Connection Strings and Data Source
      • Connection string
    • Data Types
      • Overview of data types
    • Command and Parameter
      • Overview
      • ArrayBinding
      • AutoCommit and Transactions
    • Result Set
      • Result set types
    • ORM and Frameworks
      • Use Entity Framework Core
      • Use SqlSugar
      • Use FreeSql
      • Use the ABP Framework
  • Reference Information
    • Common Interfaces
      • Overview of commonly used interfaces
  • Version Release Records
    • OceanBase Connector/NET V1.0.0
    • OceanBase Connector/NET V1.1.0
    • OceanBase Connector/NET V1.2.0
    • OceanBase Connector/NET V1.3.1

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Connector/NET
  3. V1.3.1

Use the ABP Framework

Last Updated:2026-09-22 03:13:33

Installation
Module registration
DbContext and connection string
Database migration
Extended capabilities provided by the ABP Provider
Considerations
1. Do not manually set UseDbFunction (ABP 8 + EF Core 8)
2. Replacement relationship with the official Oracle module
3. Version and capability boundaries
Reference example

OceanBase.Abp.EntityFrameworkCore is an ABP Provider for ABP + EF Core + OceanBase Oracle mode, replacing the Volo.Abp.EntityFrameworkCore.Oracle connection path. The application must also reference the OceanBase.EntityFrameworkCore6/7/8 EF Core Provider and the OceanBase.ManagedDataAccess driver that match the major version.

For the connection string format, see Connection strings; for the capabilities of the EF Core Provider, see Use Entity Framework Core.

Note

The ABP Provider supports application target frameworks net6.0, net7.0, and net8.0, which must match the main versions of the application's ABP and EF Core. The V1.3.1 validation matrix is ABP 6.0.3 / 7.0.0 / 8.3.4 paired with EF Core 6 / 7 / 8 Providers.

Installation

Reference the corresponding NuGet package for the application's target framework (example: EF Core 8 + ABP 8):

dotnet add package OceanBase.ManagedDataAccess
dotnet add package OceanBase.EntityFrameworkCore8
dotnet add package OceanBase.Abp.EntityFrameworkCore

Simultaneously install the ABP module packages required by the business (such as Identity, TenantManagement, OpenIddict, etc.), with versions matching the major version of Volo.Abp.EntityFrameworkCore that OceanBase.Abp.EntityFrameworkCore depends on.

Application target framework
EF Core Provider
Typical ABP Versions
net6.0 OceanBase.EntityFrameworkCore6 ABP 6.x
net7.0 OceanBase.EntityFrameworkCore7 ABP 7.x
net8.0 OceanBase.EntityFrameworkCore8 ABP 8.x

Module registration

In the EntityFrameworkCore Layer Module:

  1. Replace AbpEntityFrameworkCoreOracleModule (if present) in DependsOn with AbpEntityFrameworkCoreOceanBaseModule.
  2. In ConfigureServices, configure all (or specified) AbpDbContext instances with AbpDbContextOptions.UseOceanBaseForOracle().
using Microsoft.Extensions.DependencyInjection;
using OceanBase.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;

[DependsOn(
    typeof(AbpEntityFrameworkCoreOceanBaseModule),
    typeof(AbpIdentityEntityFrameworkCoreModule)
    // … Other ABP EF modules
)]
public class MyProjectEntityFrameworkCoreModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddAbpDbContext<MyProjectDbContext>(options =>
        {
            options.AddDefaultRepositories(includeAllEntities: true);
        });

        Configure<AbpDbContextOptions>(options =>
        {
            // Use OceanBase Oracle for all AbpDbContext instances
            options.UseOceanBaseForOracle();

            // Or configure it only for the specified DbContext:
            // options.UseOceanBaseForOracle<MyProjectDbContext>();
        });
    }
}

The UseOceanBaseForOracle extension is located in the namespace OceanBase.Abp.EntityFrameworkCore. Its signature is consistent with the UseOracle() method of the official ABP Oracle module, allowing for a direct migration using the original Oracle template.

DbContext and connection string

The definition of AbpDbContext, the mapping in the Configure* module, and [ConnectionStringName] are the same as in a standard ABP project. The connection string is written in appsettings.json:

{
  "ConnectionStrings": {
    "Default": "server=<host>;port=2881;user id=<account>;password=<password>;database=<schema>;"
  }
}

In multi-tenant database sharding scenarios, you can additionally configure tenant-specific connection strings (such as TenantDefault), which are parsed by the ABP tenant and used with DbMigrator.

Database migration

The migration process is consistent with the official ABP documentation:

# In the directory of the EntityFrameworkCore project
dotnet ef migrations add Initial

# In the DbMigrator project
dotnet run

The design-time factory (IDesignTimeDbContextFactory) also uses UseOceanBaseForOracle() to configure DbContextOptions.

Extended capabilities provided by the ABP Provider

Compared to "only referencing the EF Core Provider and integrating ABP manually," this ABP Provider additionally includes:

capability
Description
Module registration AbpEntityFrameworkCoreOceanBaseModuleRegister default options for OceanBase (such as sequential GUID type).
Generate Global Filter SQL Adapted filter translations for ABP multi-tenancy and soft deletion in Oracle-compatible mode
ExtraPropertiesValue conversion Compatible with Oracle's extended attribute JSON/numeric precision
DbContext Configuration UseOceanBaseForOracle()Integrate with the ABP DbContext configuration process

Considerations

1. Do not manually set UseDbFunction (ABP 8 + EF Core 8)

The ABP Provider defaults to UseDbFunction = false. If manually changed to true, EFCompileAsyncQuery may fix the filter switch state at compile time, thereby bypassing ABP's multi-tenant/soft-deletion global filters. If your application uses Compiled Queries, please keep the default configuration.

2. Replacement relationship with the official Oracle module

  • NuGet package: Replace Volo.Abp.EntityFrameworkCore.Oracle with OceanBase.Abp.EntityFrameworkCore.
  • Module: Replace AbpEntityFrameworkCoreOracleModule with AbpEntityFrameworkCoreOceanBaseModule.
  • DbContext configuration: Replace options.UseOracle() with options.UseOceanBaseForOracle().

3. Version and capability boundaries

  • You must use the EF Core 6/7/8 Provider and driver that matches the main version of the ABP Provider; do not mix assemblies.
  • EF migration scripts for ABP modules (such as Identity, OpenIddict, etc.) must be tested in the target OceanBase Oracle database.
  • For more information on EF capability boundaries (LINQ translation, reverse engineering, type mapping), see Use Entity Framework Core.

Reference example

The driver repository provides a sample project for ABP 8.3.4 + EF Core 8, samples/AbpOceanBase (including DbMigrator, HttpApi.Host, OpenIddict), which can serve as a reference skeleton for migration from Volo.Abp.EntityFrameworkCore.Oracle.

Previous topic

Use FreeSql
Last

Next topic

Overview of commonly used interfaces
Next
on this page
Installation
Module registration
DbContext and connection string
Database migration
Extended capabilities provided by the ABP Provider
Considerations
1. Do not manually set UseDbFunction (ABP 8 + EF Core 8)
2. Replacement relationship with the official Oracle module
3. Version and capability boundaries
Reference example