Junction Registration
Extension methods for registering Trax.Core junctions with [Inject] property injection support. These are aliases for the corresponding Train Registration methods — the injection behavior is identical.
Signatures
Generic Overloads
public static IServiceCollection AddScopedTraxJunction<TService, TImplementation>(
this IServiceCollection services
) where TService : class where TImplementation : class, TService
public static IServiceCollection AddTransientTraxJunction<TService, TImplementation>(
this IServiceCollection services
) where TService : class where TImplementation : class, TService
public static IServiceCollection AddSingletonTraxJunction<TService, TImplementation>(
this IServiceCollection services
) where TService : class where TImplementation : class, TServiceNon-Generic Overloads
public static IServiceCollection AddScopedTraxJunction(
this IServiceCollection services, Type serviceInterface, Type serviceImplementation
)
public static IServiceCollection AddTransientTraxJunction(
this IServiceCollection services, Type serviceInterface, Type serviceImplementation
)
public static IServiceCollection AddSingletonTraxJunction(
this IServiceCollection services, Type serviceInterface, Type serviceImplementation
)Example
services.AddScopedTraxJunction<IValidateOrderJunction, ValidateOrderJunction>();
services.AddTransientTraxJunction<IProcessPaymentJunction, ProcessPaymentJunction>();Remarks
- These methods delegate directly to the train registration equivalents. They exist for semantic clarity —
AddTraxJunctioncommunicates intent better thanAddTraxRoutewhen registering junctions. - Junctions typically don't need manual DI registration unless they use
[Inject]properties. Most junctions are created by the train'sChain<TJunction>()method using Memory-based constructor injection.
SDK Reference
> Chain