protected override Expression VisitSingleton(SingletonCallSite singletonCallSite, CallSiteExpressionBuilderContext context) { if (TryResolveSingletonValue(singletonCallSite, out var value)) { return(Expression.Constant(value)); } return(Expression.Call( Expression.Constant(_runtimeResolver), CallSiteRuntimeResolverResolve, Expression.Constant(singletonCallSite, typeof(IServiceCallSite)), context.ScopeParameter)); }
protected override Expression VisitSingleton(SingletonCallSite singletonCallSite, ILEmitResolverBuilderContext argument) { if (TryResolveSingletonValue(singletonCallSite, out var value)) { AddConstant(argument, value); return(null); } // this.RuntimeResolver.Resolve(singletonCallSite) argument.Generator.Emit(OpCodes.Ldarg_0); argument.Generator.Emit(OpCodes.Ldfld, RuntimeResolverField); AddConstant(argument, singletonCallSite); argument.Generator.Emit(OpCodes.Ldarg_0); argument.Generator.Emit(OpCodes.Ldfld, RootField); argument.Generator.Emit(OpCodes.Callvirt, ExpressionResolverBuilder.CallSiteRuntimeResolverResolve); return(null); }
protected override Type VisitSingleton(SingletonCallSite singletonCallSite, CallSiteValidatorState state) { state.Singleton = singletonCallSite; return(VisitCallSite(singletonCallSite.ServiceCallSite, state)); }
protected abstract TResult VisitSingleton(SingletonCallSite singletonCallSite, TArgument argument);
protected override object VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider) { return(VisitScoped(singletonCallSite, provider.Root)); }
protected override object VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) { return(VisitScoped(singletonCallSite, scope.Engine.Root)); }