Exemple #1
0
        public InstanceProduct(
            BindingExtender bindingExtender,
            IMethodProduct?predicateMethod,
            IMethodProduct factoryObjectMethod,
            IMethodProduct funcMethod,
            IMethodProduct?disposeMethod,
            IReadOnlyList <UnknownTypeProduct>?unknownTypeProducts
            )
        {
            if (bindingExtender is null)
            {
                throw new ArgumentNullException(nameof(bindingExtender));
            }

            if (factoryObjectMethod is null)
            {
                throw new ArgumentNullException(nameof(factoryObjectMethod));
            }

            if (funcMethod is null)
            {
                throw new ArgumentNullException(nameof(funcMethod));
            }

            BindingExtender     = bindingExtender;
            PredicateMethod     = predicateMethod;
            FactoryObjectMethod = factoryObjectMethod;
            FuncMethod          = funcMethod;
            DisposeMethod       = disposeMethod;
            UnknownTypeProducts = unknownTypeProducts ?? new List <UnknownTypeProduct>();
        }
        private IMethodProduct CreateExplicitMethod(
            string explicitMethodName,
            IMethodProduct nonExplicitMethod,
            DpdtArgumentWrapperTypeEnum wrapperType,
            ITypeSymbol wrapperSymbol
            )
        {
            var explicitMethodProduct = MethodProductFactory.Create(
                explicitMethodName,
                nonExplicitMethod.MethodResult,
                (methodName, returnType) => $@"{returnType} {GN.IResolution}<{wrapperSymbol.ToGlobalDisplayString()}>.{methodName}({GN.IResolutionRequest} resolutionRequest)
{{
    return {nonExplicitMethod.MethodName}(resolutionRequest);
}}
"
                );

            return(explicitMethodProduct);
        }
        public ResolutionProduct(
            IInterfaceProduct interfaceProduct,
            IInterfaceProduct interfaceFastProduct,
            IMethodProduct retrieveMethod,
            IMethodProduct retrieveExplicitMethod,
            CreateTupleProduct nonGenericGetTuple,
            IMethodProduct retrieveAllMethod,
            IMethodProduct retrieveAllExplicitMethod,
            CreateTupleProduct nonGenericGetAllTuple,
            IMethodProduct retrieveFastMethod
            )
        {
            if (interfaceProduct is null)
            {
                throw new ArgumentNullException(nameof(interfaceProduct));
            }

            if (interfaceFastProduct is null)
            {
                throw new ArgumentNullException(nameof(interfaceFastProduct));
            }

            if (retrieveMethod is null)
            {
                throw new ArgumentNullException(nameof(retrieveMethod));
            }

            if (retrieveExplicitMethod is null)
            {
                throw new ArgumentNullException(nameof(retrieveExplicitMethod));
            }

            if (nonGenericGetTuple is null)
            {
                throw new ArgumentNullException(nameof(nonGenericGetTuple));
            }

            if (retrieveAllMethod is null)
            {
                throw new ArgumentNullException(nameof(retrieveAllMethod));
            }

            if (nonGenericGetAllTuple is null)
            {
                throw new ArgumentNullException(nameof(nonGenericGetAllTuple));
            }

            if (retrieveFastMethod is null)
            {
                throw new ArgumentNullException(nameof(retrieveFastMethod));
            }

            InterfaceProduct          = interfaceProduct;
            InterfaceFastProduct      = interfaceFastProduct;
            RetrieveMethod            = retrieveMethod;
            RetrieveExplicitMethod    = retrieveExplicitMethod;
            NonGenericGetTuple        = nonGenericGetTuple;
            RetrieveAllMethod         = retrieveAllMethod;
            RetrieveAllExplicitMethod = retrieveAllExplicitMethod;
            NonGenericGetAllTuple     = nonGenericGetAllTuple;
            RetrieveFastMethod        = retrieveFastMethod;
        }