Skip to content

Instantly share code, notes, and snippets.

@kasunkv
Created May 7, 2019 15:50
Show Gist options
  • Save kasunkv/5ac0aa15e3f3468ab1fe150a4dbbb716 to your computer and use it in GitHub Desktop.
Save kasunkv/5ac0aa15e3f3468ab1fe150a4dbbb716 to your computer and use it in GitHub Desktop.
Register multiple implementations - Method 02
services.AddScoped<IDiscountProcessor, OrderDiscountProcessor>();
services.TryAddEnumerable(new[]
{
ServiceDescriptor.Scoped<IDiscount, SeasonalDiscount>(),
ServiceDescriptor.Scoped<IDiscount, LargeOrderDiscount>(),
ServiceDescriptor.Scoped<IDiscount, ThreeOrModeDiscount>()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment