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));
        }
示例#2
0
        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));
 }
示例#4
0
 protected abstract TResult VisitSingleton(SingletonCallSite singletonCallSite, TArgument argument);
示例#5
0
 protected override object VisitSingleton(SingletonCallSite singletonCallSite, ServiceProvider provider)
 {
     return(VisitScoped(singletonCallSite, provider.Root));
 }
示例#6
0
 protected override object VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope)
 {
     return(VisitScoped(singletonCallSite, scope.Engine.Root));
 }