Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 791 Bytes

File metadata and controls

25 lines (17 loc) · 791 Bytes

DotJoshJohnson.Decorators

A utility library that adds an AddDecorator() extension method to IServiceCollection to make using the decorator pattern in .NET a breeze!

Getting Started

  1. Install DotJoshJohnson.Decorators via NuGet.
  2. Add your base service implementation first, then any decorators.
using Microsoft.Extensions.DependencyInjection;

// ... //

services
    .AddTransient<IMyService, MyService>()
    .AddDecorator<IMyService, MyFirstDecorator>()
    .AddDecorator<IMyService, MySecondDecorator>();

// ... //

var myDecoratedService = serviceProvider.GetRequiredService<IMyService>();

Party Balloons icon by Icons8