示例#1
0
        private static object CreateLazyDelegate(IContainerContext containerContext, IServiceRegistration serviceRegistration, ResolutionContext resolutionContext, Type type, object[] arguments)
        {
            var expr = serviceRegistration.GetExpression(containerContext, resolutionContext, type);

            return(expr.AsLambda(resolutionContext.ParameterExpressions.SelectMany(x => x))
                   .CompileDynamicDelegate(resolutionContext)(resolutionContext.ResolutionScope).DynamicInvoke(arguments));
        }
示例#2
0
        private static object CreateLazyDelegate(IServiceRegistration serviceRegistration, ResolutionInfo resolutionInfo, Type type, object[] arguments)
        {
            var expr = serviceRegistration.GetExpression(resolutionInfo, type);

            return(Expression.Lambda(expr, resolutionInfo.ParameterExpressions).CompileDelegate(Constants.ScopeExpression)(resolutionInfo.ResolutionScope).DynamicInvoke(arguments));
        }