Replies: 1 comment
-
I mean when call VisitCallSite in RuntimeResolverContext argument is not null ![]() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm researching the Dependency Injection library for Net 8.
Here's a simple code example:
`
public class CreateServiceByExpressionTest
{
[Fact]
private void CreateServiceByServiceProviderTest()
{
var serviceScopedCollection = new ServiceCollection();
serviceScopedCollection.AddScoped<IBaz, Baz>();
var serviceProvider = serviceScopedCollection.BuildServiceProvider();
var scope = serviceProvider.CreateScope();
// First call
var bazFromScopeFirst = scope.ServiceProvider.GetService();
// Second call
var bazFromScopeSecond = scope.ServiceProvider.GetService();
Assert.True(ReferenceEquals(bazFromScopeFirst, bazFromScopeSecond));
}
}

`
Let's say we'll use ExpressionResolverBuilder to replace the ServiceAccessor object's delegate, Func<ServiceProviderEngineScope, object?> RealizedService (Expression build)
in DynamicServiceProviderEngine (as I understand it, this is for netstandard2.0).
For CallSiteRuntimeResolver, I understand that RuntimeResolverContext is needed to optimize locking for CallSiteVisitor methods with recursion on the same thread.
Why is TArgument null for ExpressionResolverBuilder, since it also has recursion?
Beta Was this translation helpful? Give feedback.
All reactions