Ejemplo n.º 1
0
 public InpcClassGenerator(
     ClassToImplement target,
     INotifyImplementationStategy notifyStrategy,
     GeneratorExecutionContext context)
 {
     this.target         = target;
     this.notifyStrategy = notifyStrategy;
     codeWriter          = new CodeWriter(context);
 }
 public InpcPropertyGenerator(FieldDeclarationSyntax fieldToWrap,
                              CodeWriter codeWriter,
                              ClassToImplement target,
                              INotifyImplementationStategy notifyStrategy,
                              VariableDeclaratorSyntax variable)
 {
     this.fieldToWrap  = fieldToWrap;
     fieldToWrapSymbol =
         (target.SemanticModel.GetDeclaredSymbol(fieldToWrap.Declaration.Variables.First())
          as IFieldSymbol) ??
         throw new InvalidProgramException("This should be an IFieldSymbol");
     ;
     this.codeWriter     = codeWriter;
     this.target         = target;
     this.notifyStrategy = notifyStrategy;
     this.variable       = variable;
     fieldName           = this.variable.Identifier.ToString();
     propertyName        = ComputePropertyName(fieldName);
 }