Skip to content

Commit

Permalink
remove support for object dynamic decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi committed Oct 17, 2021
1 parent f4341b5 commit 311ed1e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/DryIoc/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,8 @@ KV<object, Factory>[] IContainer.GetServiceRegisteredAndDynamicFactories(Type se
return factories;
}

private static int _objectTypeHash = RuntimeHelpers.GetHashCode(typeof(object));

Expression IContainer.GetDecoratorExpressionOrDefault(Request request)
{
var container = request.Container;
Expand Down Expand Up @@ -1510,7 +1512,8 @@ Expression IContainer.GetDecoratorExpressionOrDefault(Request request)

// Append generic type argument decorators, registered as Object
// Note: the condition for type arguments should be checked before generating the closed generic version
var typeArgDecorators = container.GetDecoratorFactoriesOrDefault(typeof(object)); // todo: @perf add the rule for the object decorator to speedup the check
// Note: the dynamic rules for the object is not supported, sorry - to much of performance hog to be called every time
var typeArgDecorators = _registry.Value.Decorators.GetValueOrDefault(_objectTypeHash, typeof(object)) as Factory[];
if (!typeArgDecorators.IsNullOrEmpty())
{
typeArgDecorators = typeArgDecorators.Match(request, (r, d) => d.CheckCondition(r));
Expand Down

0 comments on commit 311ed1e

Please sign in to comment.