X Tutup
Skip to content

Inner join Query #495

@santhidhanuskodi23

Description

@santhidhanuskodi23

Hi,

I get results like left join while doing nested query
query {
products {
items {
productCode
productName
client {
clientCode
clientName
}
}
}
}

query {

  clients {
   items {
    clientCode
    clientName
    products {

  clientCode
  }
}

}
}

I would like the ability to do both left and inner join. I just defined relationship in client.cs and product.cs and dbcontext.cs is also updted.

            // Configure GraphQL schema with EntityGraphQL
            services.AddGraphQLSchema<MediaDBContext>(options =>
            {
                // Hook into schema building
                options.ConfigureSchema = schema =>
                {
                    // Example: add a custom field to Client type
                    schema.UpdateType<Client>(type =>
                    {
                        type.AddField("productCount", c => c.Products.Count(), "Number of products for this client");
                    });

                };

                // Apply paging/filter/sort to list fields
                options.OnFieldCreated = field =>
                {
                    if (field.FromType?.Name == "Query" && field.ReturnType.IsList &&
                        field.ReturnType.SchemaType.GqlType == GqlTypes.QueryObject &&
                        !field.FromType.IsInterface)
                    {
                        field.UseFilter()
                             .UseSort()
                             .UseOffsetPaging(defaultPageSize: DefaultPageSize, maxPageSize: MaxPages);
                    }
                };
            });

I am stuck with the sntax how I can filter like like left or inner join

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup