Skip to content

Commit 09df58c

Browse files
authored
Update Predicates.cs (#300)
Without the given treatment, entities without a namespace (global), generate an error at startup when creating the ServiceProvider
1 parent aa00865 commit 09df58c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/AspectCore.Core/Configuration/Predicates.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ public static AspectPredicate ForNameSpace(string nameSpace)
1010
{
1111
throw new ArgumentNullException(nameof(nameSpace));
1212
}
13-
14-
return method => method.DeclaringType.Namespace.Matches(nameSpace);
13+
14+
return method => nameSpace == method.DeclaringType.Namespace ||
15+
(method.DeclaringType.Namespace != null &&
16+
method.DeclaringType.Namespace.Matches(nameSpace));
1517
}
1618

1719
public static AspectPredicate ForService(string service)
@@ -84,4 +86,4 @@ public static AspectPredicate Implement(Type baseOrInterfaceType)
8486
return methodInfo => baseOrInterfaceType.IsAssignableFrom(methodInfo.DeclaringType);
8587
}
8688
}
87-
}
89+
}

0 commit comments

Comments
 (0)