Hasim.Injectify 0.1.4

dotnet add package Hasim.Injectify --version 0.1.4
                    
NuGet\Install-Package Hasim.Injectify -Version 0.1.4
                    
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="Hasim.Injectify" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hasim.Injectify" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="Hasim.Injectify" />
                    
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 Hasim.Injectify --version 0.1.4
                    
#r "nuget: Hasim.Injectify, 0.1.4"
                    
#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 Hasim.Injectify@0.1.4
                    
#: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=Hasim.Injectify&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=Hasim.Injectify&version=0.1.4
                    
Install as a Cake Tool

Injectify

Build NuGet NuGet Downloads .NET License

A modular dependency injection system for ASP.NET Core applications. Automatically discovers modules across all projects in a solution — no manual registration needed.

Concept

Each project in your solution (Application, Core, EF Core, UI, etc.) defines its own module that registers its own dependencies. The host project (UI) discovers and initializes all modules automatically with just two calls:

// Program.cs — only 2 lines needed
var builder = WebApplication.CreateBuilder(args);
builder.InjectifyApplication();
// ...
var app = builder.Build();
app.InjectifyInitializer();
app.Run();

Features

Feature Description Status
Module System Autonomous modules with DI registration and pipeline configuration
Auto-Discovery Recursive assembly scanning to discover all IModule implementations
Module Metadata [ModuleInfo], [ModuleOrder], [DependsOn] attributes
Dependency Graph DAG validation with topological sort and cycle detection
Lifecycle Hooks OnInit, OnStart, OnStop via IModuleLifecycle
Auto DI Registration Marker interfaces (IAddSingleton, IAddScoped, IAddTransient) for automatic service registration
Unified DI API Single AddInjectifyServices() call registers all marker-implementing classes

Installation

dotnet add package Injectify

Quick Start

1. Create a module in each project (optional for DI-only services)

using Injectify.Modules;

[ModuleInfo("My Module", "1.0.0", "Description of the module")]
[ModuleOrder(10)]
public class MyModule : BaseInjectifyModule
{
    public override void ConfigureService(IServiceCollection services, IConfiguration configuration)
    {
        services.AddScoped<IMyService, MyService>();
    }

    public override void ConfigureApplication(WebApplication app)
    {
        app.Logger.LogInformation("MyModule initialized");
        app.UseMiddleware<MyMiddleware>();
    }
}

2. In the UI project — 2 lines (discovers modules + auto-registers services)

var builder = WebApplication.CreateBuilder(args);
builder.InjectifyApplication();    // Scans all assemblies, discovers all IModule + auto-registers IAddSingleton/IAddScoped/IAddTransient

var app = builder.Build();
app.InjectifyInitializer();            // Calls ConfigureApplication on each module
app.Run();

3. Auto-register services with marker interfaces (new!)

Instead of manually registering services in ConfigureService, implement the appropriate marker interface on your service implementation:

using Injectify.Abstractions;

// Automatically registered as Scoped
public interface IUserService : IAddScoped { }
public class UserService : IUserService { }

// Automatically registered as Singleton
public interface ICacheService : IAddSingleton { }
public class CacheService : ICacheService { }

// Automatically registered as Transient
public interface IEmailService : IAddTransient { }
public class EmailService : IEmailService { }

No manual services.AddScoped<>() calls needed — builder.InjectifyApplication() handles it automatically.

3. Module lifecycle

public class MyModule : BaseInjectifyModule
{
    public override void OnInit(IServiceCollection services) { /* before registration */ }
    public override void OnStart(WebApplication app)        { /* after build, before run */ }
    public override void OnStop()                           { /* on shutdown */ }
}

4. Module dependencies

[DependsOn(typeof(CoreModule))]
[DependsOn(typeof(EFCoreModule))]
public class UIModule : BaseInjectifyModule { }

Packages

Package Description
Injectify Module system with DI registration, pipeline config, and module lifecycle

Project structure

Injectify/
├── Abstractions/          # Marker interfaces: IAddSingleton, IAddScoped, IAddTransient
├── Attributes/            # [DependsOn], [ModuleInfo], [ModuleOrder]
├── Exceptions/            # InjectifyException, DependencyCycleException
├── Extensions/            # Fluent DI extensions (InjectifyApplication, InjectifyInitializer, DependencyInjectionExtensions)
├── Modules/               # IModule, IModuleLifecycle, BaseInjectifyModule
├── Setup/                 # IModuleLoader, ModuleLoader (assembly scanning, topological sort)
└── Injectify.Tests/       # Unit tests (xUnit)

Documentation

License

MIT

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 (3)

Showing the top 3 NuGet packages that depend on Hasim.Injectify:

Package Downloads
Hasim.Auditify

A lightweight, pluggable audit-trail library for EF Core 8+. Automatically captures entity changes (Added/Modified/Deleted), supports sensitive data masking, soft-delete patterns, and timestamp tracking.

Hasim.EntityFrameworkCore

A customizable ASP.NET Core Identity entities library providing reusable base identity models and common abstractions for modern .NET applications.

Hasim.Infrastructure

Todo Description.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.4 139 8/28/2026
0.1.3 91 8/27/2026
0.1.2 319 7/30/2026
0.1.1 222 7/30/2026
0.1.0 161 7/30/2026