private void InjectINPCProperties(GeneratorExecutionContext context) { if (!(context.SyntaxReceiver is INPCReceiver receiver)) { throw new InvalidProgramException("Receiver is the wrong type"); } var elaboratedClasses = receiver.ClassesToAugment.Values .Select(i => i.ElaborateSemanticInfo(context.Compilation)) .ToList(); var factory = new InpcClassGeneratorFactory(elaboratedClasses, context.Compilation.GetSpecialType(SpecialType.System_String)); var namer = new GeneratedFileUniqueNamer("INPC"); foreach (var augmenter in elaboratedClasses) { factory.CreateGenerator(augmenter, context).Generate(namer); } }
protected PartialTypeGenerator(string suffix, params string[] targetAttributes) { this.suffix = suffix; this.targetAttributes = targetAttributes; namer = new(suffix); }
public void Generate(GeneratedFileUniqueNamer namer) { codeWriter.AppendLine("#nullable enable"); GenerateCodeForClass(); codeWriter.PublishCodeInFile(namer.CreateFileName(ClassName())); }