public ResolutionProduct( InterfaceProduct interfaceProduct, InterfaceProduct interfaceFastProduct, MethodProduct retrieveMethod, MethodProduct retrieveExplicitMethod, CreateTupleProduct nonGenericGetTuple, MethodProduct retrieveAllMethod, MethodProduct retrieveAllExplicitMethod, CreateTupleProduct nonGenericGetAllTuple, MethodProduct 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; }
private ResolutionProduct CreateResolutionProduct( IReadOnlyList <InstanceProduct> filteredInstanceProducts, DpdtArgumentWrapperTypeEnum wrapperType, ITypeSymbol wrapperSymbol ) { var interfaceProduct = new InterfaceProduct( $"{nameof(IResolution<object>)}<{wrapperSymbol.ToDisplayString()}>" ); var interfaceFastProduct = new InterfaceProduct( $"{nameof(IResolutionFast<object>)}<{wrapperSymbol.ToDisplayString()}>" ); #region get var getMethodProduct = CreateGetMethod( filteredInstanceProducts, wrapperType, wrapperSymbol ); var getExplicitMethodProduct = CreateExplicitMethod( "Get", getMethodProduct, wrapperType, wrapperSymbol ); var nonGenericGetProduct = new CreateTupleProduct( ( _typeInfoProvider.SystemType(), $"typeof({wrapperSymbol.ToDisplayString()})" ), ( _typeInfoProvider.Func( _typeInfoProvider.GetTypeByMetadataName(typeof(IResolutionRequest).FullName !) !, _typeInfoProvider.Object() ! ), getMethodProduct.MethodName ) ); #endregion #region get all var getAllMethodProduct = CreateGetAllMethod( filteredInstanceProducts, wrapperType, wrapperSymbol ); var getAllExplicitMethodProduct = CreateExplicitMethod( "GetAll", getAllMethodProduct, wrapperType, wrapperSymbol ); var nonGenericGetAllProduct = new CreateTupleProduct( ( _typeInfoProvider.SystemType(), $"typeof({wrapperSymbol.ToDisplayString()})" ), ( _typeInfoProvider.Func( _typeInfoProvider.GetTypeByMetadataName(typeof(IResolutionRequest).FullName !) !, _typeInfoProvider.Object() ! ), getAllMethodProduct.MethodName ) ); #endregion #region get fast var getFastMethodProduct = new MethodProduct( nameof(IResolutionFast <object> .GetFast), wrapperSymbol, (methodName, returnType) => { return($@" [MethodImpl(MethodImplOptions.AggressiveInlining)] public {returnType.ToDisplayString()} {methodName}({returnType.ToDisplayString()} unused) {{ return {getMethodProduct.MethodName}( null ); }} "); } ); #endregion var resolutionProduct = new ResolutionProduct( interfaceProduct, interfaceFastProduct, getMethodProduct, getExplicitMethodProduct, nonGenericGetProduct, getAllMethodProduct, getAllExplicitMethodProduct, nonGenericGetAllProduct, getFastMethodProduct ); return(resolutionProduct); }