JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
563 stars 118 forks source link

Add IServiceProviderIsService to ServiceRegistry #355

Closed halter73 closed 1 year ago

halter73 commented 1 year ago

@maryamariyan was showing me this code because it looks like IServiceProviderIsService isn't being properly registered in the ServiceRegistry. I'm not sure this works, but it should be closer to working. I copied (IServiceProviderIsService)s.GetRequiredService<IContainer>() from https://github.com/JasperFx/lamar/blob/v8.0.1/src/Lamar.Microsoft.DependencyInjection/HostBuilderExtensions.cs#L90 but it doesn't look like IContainer implements IServiceProviderIsService.

We'll want to add tests, ifdef, and remove the dead code before merging this though.

jeremydmiller commented 1 year ago

@halter73 Sorry, just saw this. Lamar has supported IServiceProviderIsService in .NET 6 and above for quite awhile. Not sure what you're seeing here. There are tests passing in the codebase for the implied method injection w/ Minimal API as well.