NOF.Infrastructure 10.5.0

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

NOF.Infrastructure

Unified infrastructure entry package for the NOF Framework.

Overview

NOF.Infrastructure provides the default runtime wiring for NOF applications, including:

  • builder defaults and step orchestration
  • in-memory cache and messaging riders
  • EF Core integration through UseDbContext<TDbContext>()
  • OpenTelemetry registration and transport middleware
  • tenant-aware NOFDbContext support
  • builder-scoped TypeResolver
  • ambient IMapper / IIdGenerator activation through scoped IDaemonService

This lets consumers reference one package/project while still getting the full default infrastructure setup.

Usage

Add a single reference to NOF.Infrastructure in host or infrastructure-adapter projects.

Installation

dotnet add package NOF.Infrastructure

Built-in Capabilities

This package includes:

  • in-memory cache (ICacheService + MemoryCacheServiceRider)
  • in-memory riders (MemoryCommandRider, MemoryNotificationRider)
  • in-process event publisher (IEventPublisher)
  • EF Core infrastructure primitives (NOFDbContext, outbox/inbox entities, tenant-aware model customization, NOFDbContextFactory)
  • SQLite-based default persistence used by infrastructure defaults

The default in-memory cache implementation is isolated per NOF host:

  • cache data lives in MemoryCacheServiceRiderState
  • local GetOrSetAsync(...) locks live in CacheServiceLocalLockState
  • both are registered as DI singletons instead of process-wide static state

EF Core

Built-in EF Core support is configured through UseDbContext<TDbContext>() and EFCoreSelector:

using Microsoft.EntityFrameworkCore;
using NOF.Infrastructure;

var builder = NOFWebApplicationBuilder.Create(args);

builder.UseDbContext<AppDbContext>()
    .WithTenantMode(TenantMode.DatabasePerTenant)
    .WithConnectionString(builder.Configuration.GetConnectionString("postgres")
        ?? throw new InvalidOperationException("Connection string 'postgres' not found."))
    .WithOptions(static (optionsBuilder, connectionString) => optionsBuilder.UseNpgsql(connectionString))
    .MigrateOnInitialize();

Available configuration methods:

  • WithTenantMode(...)
  • WithConnectionString(...)
  • WithOptions(...)
  • WithModelCreating(...)
  • MigrateOnInitialize()

SQLite

For SQLite, provide the provider configuration via WithOptions(...):

builder.UseDbContext<AppDbContext>()
    .WithTenantMode(TenantMode.SharedDatabase)
    .WithConnectionString(builder.Configuration.GetConnectionString("sqlite")
        ?? throw new InvalidOperationException("Connection string 'sqlite' not found."))
    .WithOptions(static (optionsBuilder, connectionString) => optionsBuilder.UseSqlite(connectionString))
    .MigrateOnInitialize();

In-Memory SQLite

For tests or lightweight local scenarios, you can use the built-in default SQLite memory configuration that ships with AddInfrastructureDefaults(). If you need a custom app DbContext, configure it explicitly with UseDbContext<TDbContext>().

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (11)

Showing the top 5 NuGet packages that depend on NOF.Infrastructure:

Package Downloads
NOF.Test

Testing support for applications built with NOF, including lightweight test hosts, scoped execution helpers, and application-oriented integration testing utilities.

NOF.Hosting.AspNetCore

ASP.NET Core hosting for the NOF Framework - OpenAPI service registration, JSON configuration, and CORS.

NOF.Infrastructure.EntityFrameworkCore.PostgreSQL

PostgreSQL provider for the NOF Framework EF Core infrastructure, powered by Npgsql.

NOF.Infrastructure.EntityFrameworkCore

EF Core infrastructure for the NOF Framework — NOFDbContext, repository pattern, transactional outbox, and multi-tenancy support.

NOF.Infrastructure.StackExchangeRedis

Redis caching infrastructure for the NOF Framework, powered by StackExchange.Redis.

GitHub repositories

This package is not used by any popular GitHub repositories.