public GraphTypeBuilder <Child> Configure(GraphTypeBuilder <Child> builder) => builder .ListField(x => x.ListOfInts).Preloaded() .ListField(x => x.ListOfTextures).Preloaded() .ScalarField(x => x.ComplexThing).Preloaded() .ListField(x => x.MoreThings).Preloaded() ;
public void DefaultName() { var map = new Internal.ScalarTypeMap(); var cache = new Internal.GraphTypeCache(map); var graphType = new GraphTypeBuilder <Model>(map).BuildGraphType(cache, new ServiceCollection()); graphType.Name.Should().Be(nameof(Model)); }
public void CustomName() { var graphType = new GraphTypeBuilder <Model>(new Internal.ScalarTypeMap()) .Named("ImmaCustomName") .BuildGraphType(new Internal.GraphTypeCache(new Internal.ScalarTypeMap()), new ServiceCollection()); graphType.Name.Should().Be("ImmaCustomName"); }
public GraphTypeBuilder <SimpleScalarQueryModel <Child> > Configure(GraphTypeBuilder <SimpleScalarQueryModel <Child> > builder) { return(builder .Named("Query") .LooseScalarField(x => x.Child) .WithArgs <Args>() .ResolvesVia <Resolver>() ); }
public void ThrowsForUnspecifiedPropSameType() { var map = new Internal.ScalarTypeMap(); var builder = new GraphTypeBuilder <Model>(map) .ScalarField(x => x.Child1) .ResolvesVia <ChildModel1.Resolver>(); new Action(() => builder.BuildGraphType(new Internal.GraphTypeCache(map), new ServiceCollection())) .Should() .Throw <UnableToResolveException>() .WithMessage("Unable to resolve property Child1a on class Model"); }
public void BuildsSchema() { var map = new Internal.ScalarTypeMap(); var builder = new GraphTypeBuilder <Model>(map) .ScalarField(x => x.Child1) .ResolvesVia <ChildModel1.Resolver>() .ScalarField(x => x.Child1a) .ResolvesVia <ChildModel1.Resolver>() .ScalarField(x => x.Child2) .ResolvesVia <ChildModel2.Resolver>(); builder.BuildGraphType(new Internal.GraphTypeCache(map), new ServiceCollection()).Should().NotBeNull(); }
public void OverrideToId() { var map = new Internal.ScalarTypeMap(); var graphType = new GraphTypeBuilder <Model>(map) .ScalarField(x => x.StringVal) .AsGraphType <IdGraphType>() .BuildGraphType(new Internal.GraphTypeCache(map), new ServiceCollection()); graphType.Fields .SingleOrDefault(x => x.Name == nameof(Model.StringVal)) .Should() .BeEquivalentTo(new { Type = typeof(IdGraphType), }); }
protected override GraphTypeBuilder <GrandchildObject> ConfigureGrandchild(GraphTypeBuilder <GrandchildObject> builder) { return(builder.ScalarField(x => x.CircularRelationship) .ResolvesVia <ChildFromGrandchildResolver>()); }
protected virtual GraphTypeBuilder <GrandchildObject> ConfigureGrandchild(GraphTypeBuilder <GrandchildObject> builder) { return(builder.IgnoreProperty(x => x.CircularRelationship)); }
private GraphTypeBuilder <ChildObject> ConfigureChildObject(GraphTypeBuilder <ChildObject> builder) { return(builder.ScalarField(x => x.Child) .ResolvesVia <GrandchildResolver>()); }
internal ConnectionFieldWithArgsBuilder(GraphTypeBuilder <T> parent, Expression <Func <T, IEnumerable <TElem> > > propExpr) { _parent = parent; _propExpr = propExpr; }
private GraphTypeBuilder <ChildObject> ConfigureChildObject(GraphTypeBuilder <ChildObject> builder) { return(builder.ScalarField(x => x.Child) .Preloaded()); }
private GraphTypeBuilder <Query> ConfigureQuery(GraphTypeBuilder <Query> builder) => builder .Nullable(x => x.Nullable);
internal ScalarFieldBuilder(GraphTypeBuilder <TModel> parentBuilder, PropertyInfo prop) { _parentBuilder = parentBuilder; _prop = prop; }
public GraphTypeBuilder <Args> Configure(GraphTypeBuilder <Args> builder) => builder.IgnoreProperty(x => x.IgnoredString);
private GraphTypeBuilder <ChildObject> BuildChildObject(GraphTypeBuilder <ChildObject> builder) { return(ConfigureViaBaseType(builder) .IgnoreProperty(x => x.Ignored)); }
internal LooseScalarFieldWithArgsBuilder(GraphTypeBuilder <TModel> parentBuilder, PropertyInfo prop) { _parentBuilder = parentBuilder; _prop = prop; }
private GraphTypeBuilder <ConnectionArgs> ConfigureArgs(GraphTypeBuilder <ConnectionArgs> builder) { return(builder.ConfigureOrderBy( x => x.OrderBy, ConfigureOrderBy)); }
internal ListFieldBuilder(GraphTypeBuilder <TModel> parentBuilder, PropertyInfo prop, ScalarTypeMap scalarTypeMap) { _parentBuilder = parentBuilder; _prop = prop; _scalarTypeMap = scalarTypeMap; }
public AuthorizationBuilder(GraphTypeBuilder <TModel> parent, Expression <Func <TModel, TProp> > expr) { this._parent = parent; this._expr = expr; }
internal LooseListFieldBuilder(GraphTypeBuilder <TModel> parentBuilder, Expression <Func <TModel, IEnumerable <TElem> > > propExpr, ScalarTypeMap scalarTypeMap) { _scalarTypeMap = scalarTypeMap; _parentBuilder = parentBuilder; _propExpr = propExpr; }
internal LooseListFieldWithArgsBuilder(GraphTypeBuilder <TModel> parentBuilder, Expression <Func <TModel, IEnumerable <TElem> > > propExpr) { _parentBuilder = parentBuilder; _propExpr = propExpr; }
private GraphTypeBuilder <T> ConfigureViaBaseType <T>(GraphTypeBuilder <T> builder) where T : class, IChildObjectBase { return(builder.IgnoreProperty(x => x.IgnoredViaBase)); }
private GraphTypeBuilder <Args> ConfigureArgs(GraphTypeBuilder <Args> builder) => builder .NonNullable(x => x.OrderBy) .Nullable(x => x.SearchText);