public void AddGenericMutationAsync <TMutation, TResolverSource>( string name, RootResolver <TResolverSource> resolver ) where TMutation : GraphType where TResolverSource : class { this.FieldAsync <TMutation>( name, arguments: resolver, resolve: ctx => resolver.ResolveAsync(ctx, base.DataContext) ); }
public void DefineSingleAndConnection <TGraphType, TSourceType>(string name, RootResolver <TSourceType> resolver) where TGraphType : GraphType where TSourceType : class { var namePlural = (name.EndsWith("s")) ? name + "es" // species -> specieses. Since we *have* to differentiate, even if not gramatically correct. : name + "s"; // contact -> contacts. this.FieldAsync <TGraphType>( name, arguments: resolver, resolve: ctx => resolver.ResolveAsync(ctx, base.DataContext) ); this.DefineConnectionAsync <object, TGraphType, TSourceType>( namePlural, base.DataContext, (ctx, first, after, order) => resolver.ResolvePageAsync(ctx, first, after, order) ); }