Space.DependencyInjection 1.1.11

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

Space.DependencyInjection

Dependency Injection extensions + source generator bootstrap for the Space framework. Provides the AddSpace entry point that wires up all discovered handlers, pipelines, notifications and system modules without runtime reflection.

Install

 dotnet add package Space.DependencyInjection

(Brings in Space.Abstraction.)

Quick Start

var services = new ServiceCollection();
services.AddSpace(options =>
{
    options.ServiceLifetime = ServiceLifetime.Scoped;      // Lifetime of generated registrations
    options.NotificationDispatchType = NotificationDispatchType.Parallel; // or Sequential
});
// Optional built?in module providers
services.AddSpaceInMemoryCache(); // if using InMemoryCache module package

var provider = services.BuildServiceProvider();
var space = provider.GetRequiredService<ISpace>();

// Send a request
var loginResponse = await space.Send<UserLoginResponse>(new UserLoginRequest("demo"));

// Publish an event (all [Notification] handlers of matching event type will be invoked)
await space.Publish(new UserLoggedInSuccessfully("demo"));

Named Handlers

If multiple [Handle] methods target the same request/response, give them distinct Name values and select at call time:

var result = await space.Send<PriceResult>(query /* request object */, handlerName: "Discounted");

(The overload with handlerName is source?generated.)

Modules

Framework & custom modules are activated by annotating handler methods with their module attribute (e.g. [CacheModule(Duration = 60)]). System modules run before user pipelines. Add supporting package/providers before calling the handler.

In-Memory Cache Example

services.AddSpace();
services.AddSpaceInMemoryCache();

public class UserQueries
{
    [Handle]
    [CacheModule(Duration = 30)]
    public ValueTask<UserDetail> GetUser(HandlerContext<UserId> ctx) => ...;
}

Source-Generated Extensions (Internal)

The generator emits and AddSpace invokes:

  • AddSpaceSourceGenerated(IServiceCollection, Action<SpaceOptions>?)
  • AddSpaceModules(IServiceCollection) You normally just call services.AddSpace(...).

Notifications

Configure dispatch strategy via SpaceOptions.NotificationDispatchType (Parallel or Sequential). Each [Notification] method receives a NotificationContext<TEvent>.

Pipelines

Add cross?cutting logic with [Pipeline] methods using PipelineContext<TRequest>; use Order to influence execution relative to other pipelines (modules use very low values to run first).

Performance

No runtime reflection: all registrations & handler metadata are generated at build time for minimal overhead.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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
1.1.12-preview 59 9/7/2025
1.1.11 67 9/7/2025
1.1.10 63 9/7/2025
1.1.9 69 9/6/2025
1.1.8 121 9/5/2025 1.1.8 is deprecated because it has critical bugs.
0.1.1-preview.6 21 9/7/2025
0.1.1-preview.5 28 9/7/2025