Tharga.Runtime

Assembly scanning, runtime type discovery, and filter-based dependency injection for .NET 8 / 9 / 10. Provides IAssemblyService (cached type lookups across loaded assemblies), filter-based IServiceCollection extensions for registering many implementations of an interface in one call, and a small set of Type helpers used across Tharga libraries.

Package

Package What it does
Tharga.Runtime Assembly/type scanning, cached GetTypes lookups, and filter-based DI registration.

Quick start

dotnet add package Tharga.Runtime

Register the cache-backed assembly service:

using Tharga.Runtime;

builder.Services.AddAssemblyService();

Or skip IAssemblyService and register every implementation of a base type in one line:

builder.Services.AddSingleton<IMyHandler>(x => !x.IsAbstract);

What's in the box

  • IAssemblyService — cached, filterable type discovery across loaded assemblies. See Assembly service.
  • IServiceCollection filter extensionsAdd, AddTransient, AddScoped, AddSingleton overloads that scan and register types matching a TypeInfo filter. See Service registration.
  • Type helpersIsOfType, GetDirectlyImplementedInterfaces, ToAssemblyQualifiedNameWithoutVersion, and version-tolerant GetType(string). See Type extensions.

Repo

github.com/Tharga/Runtime — source, issues, releases.