public void AddField(string name, IGenReference reference) { var existingField = Fields.Find(p => p.Name == name); if (existingField != null) { return; } Fields.Add(new GenField { Name = name, Parent = this, Type = reference }); }
static string TypeReferenceName(GenContext context, IGenReference reference, bool fullname = false) { switch (reference) { case GenSelectionSet set: { var name = TypeName(set); var clrType = GetClrType(set); if (clrType != null) { return(ClrTypeFullName(clrType)); } if (fullname) { name = "global::" + NamespaceDeclarionName(context, set.Namespace) + "." + name; } return(name); } case GenList list: { var element = TypeReferenceName(context, list.Element, fullname); return(ClrTypeFullName(typeof(List <>)) + "<" + element + ">"); } case GenNonNull nonNull: { return(TypeReferenceName(context, nonNull.Element, fullname)); } default: throw new NotImplementedException(reference.GetType().FullName); } }
public GenList(IGenReference element) { Element = element; }
public void AddVariable(string name, IGenReference reference) => Varaibles.Add(new GenVaraible { Name = name, Type = reference });