OceanBaseConnector.DependencyInjection 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package OceanBaseConnector.DependencyInjection --version 0.1.0
                    
NuGet\Install-Package OceanBaseConnector.DependencyInjection -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OceanBaseConnector.DependencyInjection" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OceanBaseConnector.DependencyInjection" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="OceanBaseConnector.DependencyInjection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OceanBaseConnector.DependencyInjection --version 0.1.0
                    
#r "nuget: OceanBaseConnector.DependencyInjection, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OceanBaseConnector.DependencyInjection@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OceanBaseConnector.DependencyInjection&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=OceanBaseConnector.DependencyInjection&version=0.1.0
                    
Install as a Cake Tool

OceanBaseConnector for .NET

A managed ADO.NET provider for OceanBase MySQL and Oracle compatibility modes.

The driver is experimental. Recorded database runs cover direct OceanBase 4.4.2.2 with TLS disabled; the Oracle suite still has a failed case and cleanup failure. OBProxy and other deployment profiles remain unverified. See failed tests, unsupported behavior and compatibility gaps.

Packages

Package Purpose
OceanBaseConnector Connections, commands, parameters, readers and transactions.
OceanBaseConnector.DependencyInjection Optional dependency injection integration.

Both packages target netstandard2.0, netstandard2.1, net8.0, net9.0 and net10.0. Data sources and batches are available on the .NET 8/9/10 assets.

Usage

This example uses Oracle mode and a server certificate trusted by the client:

using System.Data;
using OceanBaseConnector;

using var connection = new OceanBaseConnection(
    "Server=db.example;Port=2881;User ID=test_user@tenant;Password=replace-me;ExpectedMode=Oracle");
await connection.OpenAsync();

using var command = connection.CreateCommand();
command.CommandText = "select :value from dual";
var parameter = command.CreateParameter();
parameter.ParameterName = "value";
parameter.DbType = DbType.Int32;
parameter.Value = 42;
command.Parameters.Add(parameter);

var result = await command.ExecuteScalarAsync();

ExpectedMode validates the detected mode; it does not change the server mode. TLS defaults to VerifyFull, validating certificate trust and hostnames.

Every Open confirms the actual OceanBase version and tenant mode. Server features are selected from the actual version and negotiated capabilities, without a JDBC 5/8 compatibility profile. In MySQL mode, signed TINYINT(1) returns bool by default (nonzero is true); set Treat Tiny As Boolean=false to read integers. UPDATE reports matched rows by default; set Use Affected Rows=true to request changed rows. See the configuration reference.

With the DI package:

using Microsoft.Extensions.DependencyInjection;

services.AddOceanBaseConnection(connectionString);

Each resolution creates a closed transient connection owned by its container scope. On .NET 8/9/10, AddOceanBaseDataSource and AddKeyedOceanBaseDataSource register singleton data sources; callers dispose the connections they create.

Features and limits

  • Synchronous and asynchronous SQL, server-prepared parameters, multiple results, streaming reads and binary uploads.
  • Local transactions; .NET 8/9/10 assets also expose savepoints and sequential batches.
  • Oracle extensions include stored procedures, OUT parameters, REF CURSOR, LOB locators, complex types and array binding. Procedures and output parameters require Use Oracle Prepare Execute=true; locator LOBs also require Use Lob Locators=true.
  • Explicit XA, multiple server addresses, custom address resolution, logging, tracing and metrics.
  • Connection pooling and ambient TransactionScope are not supported. Pooling=true is rejected.
  • Every connection confirms ob_version() and the tenant compatibility mode; MySQL-mode opens also require @@autocommit enabled, rejecting sessions whose implicit transactions this provider could not commit. Recognized version formats are accepted; versions beyond the recorded deployment and OBProxy still need real-server validation.

The driver does not automatically replay SQL. If OceanBaseException.IsExecutionOutcomeUnknown is true, reconcile the operation before retrying a write or commit. Batches run sequentially and need an explicit transaction for atomicity. Dispose readers, commands and connections; closing an unread reader can destroy its session.

Build and test

Requires the .NET 10 SDK. Tests run on .NET 10. Real-database integration tests never run in CI or a plain dotnet test; they need an explicit opt-in and a configured environment (integration guide).

dotnet restore OceanBaseConnector.slnx
dotnet build OceanBaseConnector.slnx -c Release --no-restore
dotnet test OceanBaseConnector.slnx -c Release --no-build --no-restore
dotnet pack OceanBaseConnector.slnx -c Release --no-build --no-restore -o TestResults/packages

To check package consumption, run pwsh -File eng/Verify-Packages.ps1 -PackageDirectory TestResults/packages. This requires PowerShell 7.1+ and .NET/ASP.NET Core 8/9/10 runtimes.

CI/CD and releases

The workflow builds and tests on Windows and Linux for pull requests targeting main/master, pushes to those branches, and tag pushes.

Event Build and test Pack and verify NuGet consumers Publish to NuGet and GitHub Releases
Pull request to main/master Yes No No
Push to main/master Yes Yes No
Version tag push Yes Yes Yes, after both operating systems pass
Other branch push No No No

Packages are built from the two projects under src/, verified on Windows, and retained as the nuget-packages workflow artifact. Tag publication downloads these same packages without rebuilding them. Real database credentials are not required by this workflow.

To release, update the shared Version in Directory.Build.props, commit it, and push a matching tag such as v0.1.0 (or 0.1.0). A mismatched tag fails before building or publishing. Prerelease versions such as v0.2.0-rc.1 create a GitHub prerelease. Configure the repository Actions secret NUGET_API_KEY with permission to publish both package IDs; the workflow uses GITHUB_TOKEN with contents: write to create the GitHub Release.

Each release records the non-merge commits since the previous reachable version tag, a comparison link, and install commands for both packages. The first release includes the initial commit history. These notes and the verified .nupkg files are attached to the GitHub Release; each NuGet package's release notes link to it. Notes are generated from Git history, so use descriptive commit subjects. This does not replace the outstanding publication review in the verification status.

Check notes generation locally with pwsh -File eng/Test-ReleaseNotes.ps1. To preview an existing tag, check out that tag and run pwsh -File eng/New-ReleaseNotes.ps1 -Tag v0.1.0; the output defaults to TestResults/packages/RELEASE_NOTES.md.

Documentation

License

MIT. See third-party notices.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 51 11/19/2026
0.3.1 51 11/18/2026
0.3.0 88 11/13/2026
0.2.0 91 11/9/2026
0.1.0 111 10/24/2026