TCIS.Logging.Autofac
1.0.0-rc.9
dotnet add package TCIS.Logging.Autofac --version 1.0.0-rc.9
NuGet\Install-Package TCIS.Logging.Autofac -Version 1.0.0-rc.9
<PackageReference Include="TCIS.Logging.Autofac" Version="1.0.0-rc.9" />
<PackageVersion Include="TCIS.Logging.Autofac" Version="1.0.0-rc.9" />
<PackageReference Include="TCIS.Logging.Autofac" />
paket add TCIS.Logging.Autofac --version 1.0.0-rc.9
#r "nuget: TCIS.Logging.Autofac, 1.0.0-rc.9"
#:package TCIS.Logging.Autofac@1.0.0-rc.9
#addin nuget:?package=TCIS.Logging.Autofac&version=1.0.0-rc.9&prerelease
#tool nuget:?package=TCIS.Logging.Autofac&version=1.0.0-rc.9&prerelease
TCIS.Logging.Autofac
A module supporting AOP (Aspect-Oriented Programming) for the logging system in TCIS, utilizing the Autofac library.
🌟 Overview
TCIS.Logging.Autofac replaces the default .NET DI Container with Autofac. Specifically, it provides:
- Assembly Scanning: Automatically scans and registers Services by Suffixes.
- AOP Interception: Automatically intercepts function calls to consistently log input parameters, execution time, and exceptions, without requiring repetitive logging code in the Business Logic.
📦 Installation
Install the package via .NET CLI:
dotnet add package TCIS.Logging.Autofac
⚙️ Configuration (appsettings.json)
You can customize AOP configurations (e.g., the list of suffixes to auto-register) in the TLogSettings:AopSettings section (default):
{
"TLogSettings": {
"AopSettings": {
"DiRegistrationSuffixes": [ "Service", "Repository", "Manager" ]
}
}
}
🚀 Usage
In Program.cs, configure the IHostBuilder to use UseTAutofacLogging:
using Microsoft.Extensions.Hosting;
using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
// Configure Autofac as the main DI Container and configure AOP Logging
builder.Host.UseTAutofacLogging(
scanAssemblies: new[] { Assembly.GetExecutingAssembly() }, // Scan the current Assembly
configSection: "TLogSettings:AopSettings", // Configuration section
configureOptions: options =>
{
// Can be configured via code instead of appsettings
options.DiRegistrationSuffixes.Add("Facade");
}
);
var app = builder.Build();
app.Run();
💡 Basic Example
When you have an Interface and an implementation Class with a name ending in Service (e.g., IUserService and UserService):
public interface IUserService
{
Task<User> GetUserAsync(int id);
}
// This class will be automatically registered by Autofac (due to the 'Service' suffix)
// and automatically intercepted to log Input, Output, and Exceptions.
public class UserService : IUserService
{
public async Task<User> GetUserAsync(int id)
{
return await _db.Users.FindAsync(id);
}
}
By simply configuring UseTAutofacLogging(), you no longer need to manually register builder.Services.AddScoped<IUserService, UserService>().
| 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 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. |
-
net8.0
- Autofac (>= 8.1.1)
- Autofac.Extensions.DependencyInjection (>= 10.0.0)
- Autofac.Extras.DynamicProxy (>= 7.1.0)
- Castle.Core.AsyncInterceptor (>= 2.1.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Options (>= 9.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.0)
- TCIS.Logging (>= 1.0.0-rc.9)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TCIS.Logging.Autofac:
| Package | Downloads |
|---|---|
|
TCIS.Pluggable.Engine.Autofac
TCIS Core Framework is an application framework for building modular, multi-tenant applications on ASP.NET Core. Autofac integration for TCIS.Pluggable.Engine |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-rc.9 | 33 | 7/21/2026 |
| 1.0.0-rc.8 | 26 | 7/21/2026 |
| 1.0.0-rc.7 | 45 | 7/17/2026 |
| 1.0.0-rc.6 | 62 | 7/7/2026 |
| 1.0.0-rc.5 | 66 | 7/7/2026 |
| 1.0.0-rc.4 | 60 | 6/24/2026 |
| 1.0.0-rc.2 | 60 | 5/12/2026 |
| 1.0.0-rc.1 | 62 | 5/12/2026 |