Skip to content

A utility library that makes using the decorator pattern in .NET a breeze!

License

Notifications You must be signed in to change notification settings

DotJoshJohnson/DotJoshJohnson.Decorators

Repository files navigation

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

About

A utility library that makes using the decorator pattern in .NET a breeze!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages