Closed kieronlanning closed 5 years ago
@kieronlanning At no point in that code are you using a Lamar container. I don't know offhand what the built in DI container supports for Lazy or Func, so you'll have to ask them.
This line:
IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(true);
Builds the default AspNetCore ServiceProvider
.
@jeremydmiller Ah, I thought because I was using a ServiceRegistry
rather than a ServiceCollection
the call to BuildServiceProvider
would build a Lamar container - my apologies! I see now it's an extension method.
I've updated to include (failing) .NET Core DI tests and working Lamar ones. Thanks for pointing me in the right direction!
Hi,
I'm having a problem resolving anything that's in a constructor with
Lazy<>
orFunc<>
.I've create a repo with a basic example consisting of three tests - one (working) with no lazy or func, and the other two with lazy and func registrations.
Is it something I'm doing/ not doing correctly?
https://github.com/kieronlanning/lamar-lazy-func-resolve