TCIS.Logging.Autofac 1.0.0-rc.9

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

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