public GraphObjectType() { var name = TypeOf <T> .Attributes.GraphName(); var description = TypeOf <T> .Attributes.GraphDescription(); if (TypeOf <T> .Is(typeof(Connection <>))) { name ??= $"{TypeOf<T>.EnclosedType!.Name}Connection"; description ??= $"A connection from an object to a list of objects of type `{TypeOf<T>.EnclosedType!.Name}`."; } else if (TypeOf <T> .Is(typeof(Edge <>))) { name ??= $"{TypeOf<T>.EnclosedType!.Name}Edge"; description ??= $"An edge in a connection from an object to another object of type `{TypeOf<T>.EnclosedType!.Name}`."; } else { name ??= TypeOf <T> .Name; description ??= $"An object of type `{TypeOf<T>.Name}`."; TypeOf <T> .InterfaceTypes.Do(type => this.Interface(type)); } this.Name = name; this.Description = description; this.DeprecationReason = TypeOf <T> .Attributes.ObsoleteMessage(); TypeOf <T> .Properties.Values .If(property => property.Getter is not null && !property.Attributes.GraphIgnore() && !property.Attributes.GraphCursor()) .Do(property => this.AddField(property.ToFieldType(false))); }
public bool Applies() { return(TypeOf <T> .Is <IEnumerator>()); }