Skip to content

Commit

Permalink
Register type itself when servicetype isn't provided
Browse files Browse the repository at this point in the history
  • Loading branch information
enisn committed May 3, 2023
1 parent d96c458 commit 6e0568e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DotNurse.Injector/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static IServiceCollection RegisterTypes(
{
foreach (var injectAsAttribute in registerAsAttribute)
if (!services.Any(a => a.ServiceType == injectAsAttribute.ServiceType))
services.Add(new ServiceDescriptor(injectAsAttribute.ServiceType, type, injectAsAttribute.ServiceLifetime ?? lifetime));
services.Add(new ServiceDescriptor(injectAsAttribute.ServiceType ?? type, type, injectAsAttribute.ServiceLifetime ?? lifetime));
continue;
}

Expand Down

0 comments on commit 6e0568e

Please sign in to comment.