Skip to content

Commit

Permalink
Performance optimization in injector
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccallum committed Oct 25, 2021
1 parent 362b69b commit f03aa76
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/FairyBread/ValidationMiddlewareInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ private static List<ValidatorDescriptor> DetermineValidatorsForArg(

private static Type? TryGetRuntimeType(IExtendedType extType)
{
// It's already a runtime type, .Type(typeof(int))
if (extType.Kind == ExtendedTypeKind.Runtime)
{
return extType.Source;
}

// Array (though not sure what produces this scenario as seems to always be list)
if (extType.IsArray)
{
Expand Down Expand Up @@ -233,11 +239,6 @@ private static List<ValidatorDescriptor> DetermineValidatorsForArg(
return argRuntimeType;
}

if (extType.Kind == ExtendedTypeKind.Runtime)
{
return extType.Source;
}

return null;
}
}
Expand Down

0 comments on commit f03aa76

Please sign in to comment.