-
-
Save dimitris-papadimitriou-chr/83783639641d0b201e8b1ea0a4540e1a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rb = RegistrationBuilder.ForDelegate((c, p) => | |
{ | |
TService? instance = (TService?)p | |
.OfType<TypedParameter>() | |
.FirstOrDefault(tp => tp.Type == typeof(TService)) | |
?.Value; | |
if (instance == null) | |
{ | |
throw new DependencyResolutionException(string.Format(CultureInfo.CurrentCulture, RegistrationExtensionsResources.DecoratorRequiresInstanceParameter, typeof(TService).Name)); | |
} | |
return decorator(c, p, instance); | |
}).As(service); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment