Korjn.OracleClientInject 9.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Korjn.OracleClientInject --version 9.0.0
                    
NuGet\Install-Package Korjn.OracleClientInject -Version 9.0.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="Korjn.OracleClientInject" Version="9.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Korjn.OracleClientInject" Version="9.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Korjn.OracleClientInject" />
                    
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 Korjn.OracleClientInject --version 9.0.0
                    
#r "nuget: Korjn.OracleClientInject, 9.0.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 Korjn.OracleClientInject@9.0.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=Korjn.OracleClientInject&version=9.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Korjn.OracleClientInject&version=9.0.0
                    
Install as a Cake Tool

Korjn.OracleClientInject

Lightweight Oracle connection factory with DI, validation, and secure configuration via IOptions pattern.

✨ Features

  • Built-in support for IOptions<T> and [Required] validation
  • Lazy, cached connection string construction
  • Secure session schema handling via ALTER SESSION
  • Safe, injectable factory (IOracleConnectionFactory) for tests or services
  • Two easy extension methods to register in your app

📦 Installation

# Coming soon via NuGet
Install-Package Korjn.OracleClientInject

🔧 Usage

1. Add to Program.cs

builder.Services.AddOracleClient(builder.Configuration);

Or with inline options:

builder.Services.AddOracleClient(options =>
{
    options.DataSource = "MyTNSAlias";
    options.TnsnamesFile = "tnsnames.ora";
    options.UserName = "scott";
    options.Password = "tiger";
    options.DefaultSchema = "myschema";
});

2. Inject and use IOracleConnectionFactory

public class MyService(IOracleConnectionFactory factory)
{
    public async Task DoSomethingAsync()
    {
        using var conn = factory.CreateConnection();
        using var cmd = conn.CreateCommand();
        cmd.CommandText = "SELECT * FROM DUAL";

        using var reader = await cmd.ExecuteReaderAsync();
        while (await reader.ReadAsync())
        {
            Console.WriteLine(reader.GetString(0));
        }
    }
}

📄 Configuration Example

{
  "OracleDbClient": {
    "TnsnamesFile": "C:\\oracle\\network\\admin\\tnsnames.ora",
    "DataSource": "ORCL",
    "UserName": "scott",
    "Password": "tiger",
    "DefaultSchema": "HR"
  }
}

📜 License

MIT © Korjn

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
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
9.0.5 145 5/21/2025
9.0.4 149 5/8/2025
9.0.3 116 5/2/2025
9.0.2 205 4/17/2025
9.0.1 96 4/5/2025
9.0.0 124 4/4/2025