Equibles.Core.AutoWiring
1.0.1
dotnet add package Equibles.Core.AutoWiring --version 1.0.1
NuGet\Install-Package Equibles.Core.AutoWiring -Version 1.0.1
<PackageReference Include="Equibles.Core.AutoWiring" Version="1.0.1" />
<PackageVersion Include="Equibles.Core.AutoWiring" Version="1.0.1" />
<PackageReference Include="Equibles.Core.AutoWiring" />
paket add Equibles.Core.AutoWiring --version 1.0.1
#r "nuget: Equibles.Core.AutoWiring, 1.0.1"
#:package Equibles.Core.AutoWiring@1.0.1
#addin nuget:?package=Equibles.Core.AutoWiring&version=1.0.1
#tool nuget:?package=Equibles.Core.AutoWiring&version=1.0.1
Equibles.Core.AutoWiring
A lightweight attribute-based service registration library for .NET. Automatically discovers and wires services into the Microsoft.Extensions.DependencyInjection container by scanning assemblies for classes decorated with [Service], reducing boilerplate and improving maintainability.
Requirements
- .NET 8.0, 9.0, or 10.0
Installation
dotnet add package Equibles.Core.AutoWiring
Usage
1. Decorate your services with [Service]
using Equibles.Core.AutoWiring;
using Microsoft.Extensions.DependencyInjection;
// Registers as itself with Scoped lifetime (default)
[Service]
public class OrderProcessor { }
// Registers as INotificationService with Singleton lifetime
[Service(ServiceLifetime.Singleton, typeof(INotificationService))]
public class EmailNotificationService : INotificationService { }
// Registers without replacing existing registrations
[Service(ServiceLifetime.Transient, typeof(INotificationService), replaceExisting: false)]
public class SmsNotificationService : INotificationService { }
2. Wire services from an assembly
using Equibles.Core.AutoWiring;
var builder = WebApplication.CreateBuilder(args);
// Scan the assembly containing Program for [Service] classes
builder.Services.AutoWireServicesFrom<Program>();
var app = builder.Build();
app.Run();
The AutoWireServicesFrom<T>() method scans the assembly containing T and registers all classes decorated with [Service].
[Service] Attribute
| Parameter | Type | Default | Description |
|---|---|---|---|
lifetime |
ServiceLifetime |
Scoped |
The DI lifetime (Singleton, Scoped, Transient) |
interfaceType |
Type |
null |
The service type to register as. If null, registers as the concrete class itself |
replaceExisting |
bool |
true |
If true, removes any existing registration for the same service type before adding |
Multi-Assembly Registration
For projects with multiple assemblies, add a marker class to each assembly and call AutoWireServicesFrom for each:
// In each assembly, add an empty marker class
public class MyAssemblyMarker { }
// In Program.cs
builder.Services.AutoWireServicesFrom<MyAssemblyMarker>();
builder.Services.AutoWireServicesFrom<AnotherAssemblyMarker>();
License
Author
Daniel Oliveira
| Product | Versions 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 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 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. |
-
net10.0
-
net8.0
-
net9.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Equibles.Core.AutoWiring:
| Repository | Stars |
|---|---|
|
daniel3303/Equibles
Self-hosted, open-source financial data MCP server for AI agents — SEC filings, XBRL financials, 13F holdings, insider & congressional trades, short interest, FRED, CFTC/CBOE and daily prices across 64 MCP tools. Equibles Cloud adds earnings call transcripts, live quotes, options chains with Greeks, guidance and a screener.
|