Пример #1
0
 protected override Expression VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, ParameterExpression provider)
 {
     return(Expression.New(typeof(ServiceScopeFactory).GetTypeInfo()
                           .DeclaredConstructors
                           .Single(),
                           provider));
 }
Пример #2
0
 protected override object VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, ILEmitResolverBuilderContext argument)
 {
     // this.ScopeFactory
     argument.Generator.Emit(OpCodes.Ldarg_0);
     argument.Generator.Emit(OpCodes.Ldfld, typeof(ILEmitResolverBuilderRuntimeContext).GetField(nameof(ILEmitResolverBuilderRuntimeContext.ScopeFactory)));
     return(null);
 }
Пример #3
0
 protected abstract TResult VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, TArgument argument);
Пример #4
0
 protected override Type VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, CallSiteValidatorState state) => null;
 protected override object VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, RuntimeResolverContext context)
 {
     return(context.Scope.Engine);//直接返回容器内的ServiceProviderEngine
 }
 protected override Expression VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, object context)
 {
     return(Expression.Constant(_serviceScopeFactory));
 }
Пример #7
0
 protected override object VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, ServiceProvider2 provider)
 {
     return(new ServiceScopeFactory(provider));
 }
Пример #8
0
 protected override object VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, ServiceProviderEngineScope scope)
 {
     return(scope.Engine);
 }
Пример #9
0
 protected override object VisitServiceScopeFactory(ServiceScopeFactoryCallSite serviceScopeFactoryCallSite, ILEmitResolverBuilderContext argument)
 {
     AddConstant(argument, serviceScopeFactoryCallSite.Value);
     return(null);
 }