Skip to content

Commit

Permalink
Fix derived generic interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Apr 24, 2024
1 parent 3b89d48 commit 2b37122
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ orderby att.IsDefault descending

public Resource Create(string type)
{
if(!_typeCache.ContainsKey(type))
if (!_typeCache.ContainsKey(type))
throw new KeyNotFoundException($"No resource of type {type} found!");

var linker = _typeCache[type];
Expand Down Expand Up @@ -339,6 +339,10 @@ internal static bool IsGenericResourceInterface(Type resourceInterface)
if (resourceInterface.GetMethods().Any(method => method.IsGenericMethod || method.ContainsGenericParameters))
return true;

// We also need to filter all interfaces that contain/inherit generic interfaces
if (resourceInterface.GetInterfaces().Any(IsGenericResourceInterface))
return true;

return false;
}
}
Expand Down

0 comments on commit 2b37122

Please sign in to comment.