AttributeBasedRegistration 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package AttributeBasedRegistration --version 1.1.2
NuGet\Install-Package AttributeBasedRegistration -Version 1.1.2
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="AttributeBasedRegistration" Version="1.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AttributeBasedRegistration --version 1.1.2
#r "nuget: AttributeBasedRegistration, 1.1.2"
#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.
// Install AttributeBasedRegistration as a Cake Addin
#addin nuget:?package=AttributeBasedRegistration&version=1.1.2

// Install AttributeBasedRegistration as a Cake Tool
#tool nuget:?package=AttributeBasedRegistration&version=1.1.2

AttributeBasedRegistration

Build Status

Library allowing registering services with Autofac and Microsoft's DI container via attributes. Additionally contains various extensions to Autofac and Microsoft's DI container.

Features

Set of attributes allowing automatic registration:

  • [ServiceImplementation] - marks the class as an implementation of a service, defines the service type(s) or a registration strategy and the lifetime of the service
  • [Intercepted] - marks the service implementation for interception, defines the interceptor types and the interception strategy - supported only with Autofac
  • [FindConstructorsWith] - defines a constructor finder to use during creation of the service instance, supports only parameterless ctors and can't be used in conjunction with interceptors - supported only with Autofac
  • [Decorated] - marks the service implementation for decoration with a specified decorator and registration order - supported only with Autofac

Installation

To pick up and register services via attributes use the extensions method on ContainerBuilder or IServiceCollection provided by the library:

builder.AddAttributeDefinedServices(assembliesToScan);

Example usage


public interface ICustomService
{

}

[ServiceImplementation(ServiceLifetime.InstancePerLifetimeScope, typeof(ICustomService))]
[Decorated(1, typeof(ISomeDecorator))]
[Intercepted(InterceptionStrategy.Interface, typeof(ISomeInterceptor))]
public class CustomService : ICustomService
{

}

[ServiceImplementation(ServiceLifetime.InstancePerDependency, RegistrationStrategy.AsSelf)]
[Decorated(1, typeof(ISomeDecorator))]
[Intercepted(InterceptionStrategy.Interface, typeof(ISomeInterceptor))]
public class AnotherCustomService
{

}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on AttributeBasedRegistration:

Package Downloads
DataExplorer

Library featuring an opinionated, reusable data access layer offering abstractions and implementations for SQL storages (EF Core).

ResultCommander

Library featuring a command handler pattern.

AttributeBasedRegistration.Autofac

Extensions to Autofac DI mainly allowing registration of services via attributes amongst other minor things.

ResultCQRS

Library featuring CQRS pattern.

DataExplorer.Unstable

Library featuring common patterns in regard to working with data storages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.6 547 1/24/2024
2.2.5 143 1/22/2024
2.2.4 82 1/22/2024
2.2.3 514 11/22/2023
2.2.2 475 11/20/2023
2.2.1 99 11/20/2023
2.2.0 152 11/20/2023
2.1.3 1,290 8/18/2023
2.1.2 820 7/10/2023
2.1.1 1,460 4/3/2023
2.1.0 1,228 3/14/2023
2.0.10 3,980 1/9/2023
2.0.9 1,089 12/22/2022
2.0.8 348 12/22/2022
2.0.7 284 12/22/2022
2.0.6 1,080 11/21/2022
2.0.5 1,317 11/19/2022
2.0.4 854 11/19/2022
2.0.3 558 11/19/2022
2.0.2 288 11/19/2022
2.0.1 331 11/19/2022
2.0.0 293 11/19/2022
1.2.15 1,482 9/27/2022
1.2.14 387 9/27/2022
1.2.13 374 9/27/2022
1.2.12 1,203 9/26/2022
1.2.11 409 9/26/2022
1.2.10 1,096 9/24/2022
1.2.9 736 9/24/2022
1.2.8 621 9/24/2022
1.2.7 381 9/24/2022
1.2.6 609 9/24/2022
1.2.5 397 9/24/2022
1.2.4 392 9/24/2022
1.2.3 421 9/24/2022
1.2.2 421 9/24/2022
1.2.1 395 9/24/2022
1.2.0 398 9/24/2022
1.1.16 407 9/24/2022
1.1.15 386 9/24/2022
1.1.14 389 9/24/2022
1.1.13 397 9/24/2022
1.1.12 398 9/24/2022
1.1.11 379 9/24/2022
1.1.10 1,584 9/19/2022
1.1.9 1,148 9/19/2022
1.1.8 1,079 9/19/2022
1.1.7 425 9/19/2022
1.1.6 1,056 9/19/2022
1.1.5 401 9/19/2022
1.1.4 399 9/19/2022
1.1.3 389 9/19/2022
1.1.2 403 9/19/2022
1.1.1 374 9/17/2022
1.1.0 392 9/17/2022
1.0.0 6,806 8/24/2022