示例#1
0
        public LambdaGenerator(
            AnalyzerResults interfaceAnalyzerResults,
            GenerationContext context,
            string className,
            LambdaCompilationScanResult scanResults,
            ProgramContext programContext
            )
        {
            this.interfaceAnalyzerResults = interfaceAnalyzerResults;
            this.context        = context;
            this.className      = className;
            this.scanResults    = scanResults;
            this.programContext = programContext;
            inputTypeName       = interfaceAnalyzerResults.InputTypeName !;
            returnType          = interfaceAnalyzerResults.OutputTypeName !;

            inputParameterType = interfaceAnalyzerResults.InputEncapsulationTypeName != null
                ? $"{interfaceAnalyzerResults.InputEncapsulationTypeName}<{inputTypeName}>"
                : inputTypeName;

            var interfaceName = context.LambdaInterfaceAttribute.InterfaceName;

            typeConstraints = new[] { SimpleBaseType(ParseTypeName($"{interfaceName}<{inputTypeName},{returnType}>")) };
            context.Usings.Add(context.LambdaInterfaceAttribute.AssemblyName);
        }
 public ConfiguratorGenerator(
     GenerationContext context,
     LambdaCompilationScanResult scanResults,
     ProgramContext programContext
     )
 {
     this.context        = context;
     this.scanResults    = scanResults;
     this.programContext = programContext;
 }