Skip to content

Commit

Permalink
fix #289 (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
nivalxer authored Nov 16, 2022
1 parent 4cc14fa commit f7af2ee
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AspectCore.Core/Configuration/Predicates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ public static AspectPredicate ForService(string service)

return method =>
{
if (method.DeclaringType.Name.Matches(service))
var declaringType = method.DeclaringType;
var declaringTypeName = declaringType.Name;
if (declaringType.IsGenericType)
{
declaringTypeName = declaringTypeName.Split('`')[0];
}
if (declaringTypeName.Matches(service))
{
return true;
}
var declaringType = method.DeclaringType;
var fullName = declaringType.FullName ?? $"{declaringType.Name}.{declaringType.Name}";
return fullName.Matches(service);
};
Expand Down

0 comments on commit f7af2ee

Please sign in to comment.