public MappingSchema(EfGraphQLService <MappingContext> graphQlService, IServiceProvider provider) :
     base(provider)
 {
     Query = new MappingQuery(graphQlService);
     RegisterTypeMapping(typeof(MappingParent), typeof(MappingParentGraph));
     RegisterTypeMapping(typeof(MappingChild), typeof(MappingChildGraph));
 }
Ejemplo n.º 2
0
    public async Task Resolve()
    {
        await using var database = await sqlInstance.Build();

        var context = database.Context;

        var parent = new MappingParent();
        var child  = new MappingChild
        {
            Parent = parent
        };
        await database.AddDataUntracked(child, parent);

        var graphQlService = new EfGraphQLService <MappingContext>(context.Model, _ => context);
        var resolve        = await(Task <IEnumerable <MappingChild> >) new MappingQuery(graphQlService).Fields
                             .Single(x => x.Name == "children")
                             .Resolver
                             .Resolve(new ResolveFieldContext());
        await Verifier.Verify(resolve);
    }
Ejemplo n.º 3
0
    public MappingSchema(EfGraphQLService <MappingContext> graphQlService) :
        base(
            new FuncDependencyResolver(
                type =>
    {
        if (type == typeof(MappingChildGraph))
        {
            return(new MappingChildGraph(graphQlService));
        }

        if (type == typeof(MappingParentGraph))
        {
            return(new MappingParentGraph(graphQlService));
        }

        return(Activator.CreateInstance(type));
    }))
    {
        Query = new MappingQuery(graphQlService);
    }
Ejemplo n.º 4
0
 public MappingSchema(EfGraphQLService <MappingContext> graphQlService, IServiceProvider provider) :
     base(provider)
 {
     Query = new MappingQuery(graphQlService);
 }