Hot Chocolate is an open-source .NET GraphQL server platform developed by ChilliCream. Use this tag for questions about code written using Hot Chocolate or for queries concerning the official documentation.
Questions tagged [hotchocolate]
393 questions
1
vote
0 answers
Add middlewares on all mutations using Hot Chocolate v11
I'm working on Transaction per mutation with EF core. I tried an implementation by adding my transaction logic into the Request pipeline UseRequest and it's quite good. But the problem with this implementation is that the transaction logic will be…

othman.Da
- 621
- 4
- 16
1
vote
1 answer
How can I log resolver/operation name and duration in HotChocolate?
I'm trying to log some basic gql method details - resolver/operation name and duration. I've started looking at using .AddHttpRequestInterceptor((context, executor, builder, ct)
and getting the info from the builder, but even though I can see it in…

Pascal Senn
- 1,712
- 11
- 20
1
vote
0 answers
Merge Rules in Hotchocolate GraphQL?
I'm using hotchocolate in .net core 3 and I'm trying to stitch / merge two objects of the same type into one object.
https://chillicream.com/docs/hotchocolate/v10/stitching#merge-rules
The documentation here talks about merge rules. "In most cases…

Enrico
- 2,734
- 1
- 27
- 40
1
vote
2 answers
Strange schema generated when doing walkthrough in v11
I'm trying to work through a very simple example of a graphql server and picked.
https://www.blexin.com/en-US/Article/Blog/Creating-our-API-with-GraphQL-and-Hot-Chocolate-79
(there's no SQL back end, I want to understand it end to end, so this has…

MrD at KookerellaLtd
- 2,412
- 1
- 15
- 17
1
vote
1 answer
Confusion over "IObjectFieldDescriptor.Type" in documentation
I'm just trying to set up some basic examples.
I want to go "code first", I need the C# compiler to tell me where I'm going wrong.
If I look at
https://chillicream.com/docs/hotchocolate/v10/schema/object-type/
there is an example
type Person {
id:…

MrD at KookerellaLtd
- 2,412
- 1
- 15
- 17
1
vote
1 answer
Aspnet core Hotchocolate GrahpQl Query not picking up arguments
Hi I have the following query class:
public class haProgrammesQuery
{
[UseFiltering]
public async Task> GetUsers([Service] haProgrammesContext Context) => Context.Users;
[UseFiltering]
…

haPartnerships
- 335
- 1
- 2
- 13
1
vote
1 answer
Dynamic IQueryable Join Query
Background:
Given the following two entities joint through one to one relationship:
public partial class Parent
{
public long Id { get; set; }
public string Email { get; set; }
public virtual Details Details{ get; set; }
}
public…

Moamen Naanou
- 1,683
- 1
- 21
- 45
1
vote
1 answer
hotchocolate throws error when using UseFiltering() on a field
I have a pretty simple setyp where I'm putting graphql over an entityframework datacontext (sql server).
I'm trying to get filtering to work. I've tried adding .UseFiltering() to a field descriptor like so...
descriptor.Field(t =>…

FeeFiFoFum
- 1,719
- 1
- 11
- 18
1
vote
1 answer
Hotchocolate, turn on/off sorting by field in a type
I expose my 'Example' class using IQueryable and apply the [UseSorting] attribute so the user can define the sort order of the results. This works fine and the Playground allows me to do exactly that.
public class QueryType : ObjectType
{
…

Phil Wright
- 22,580
- 14
- 83
- 137
1
vote
2 answers
Hot Chocolate GraphQL - MaxExecutionDepth not working
How do I get MaxExecutionDepth to work in Hot Chocolate GraphQL? Here is my code:
// Add GraphQL Services
services.AddGraphQL(
SchemaBuilder.New()
// enable for authorization support
…

System.Cats.Lol
- 1,620
- 1
- 26
- 47
1
vote
1 answer
How to set up custom GraphQL endpoint?
Recently started implementing GraphQL in .net core 3.1 project. Initially began with GraphQL.NET, which defaults the endpoint to https://localhost:44330/graphql. I eventually removed it and decided to go with Hot Chocolate, which defaults the…

Briana Finney
- 1,171
- 5
- 12
- 22
1
vote
1 answer
HotChocolate (GraphQL) schema first approach on complex type
I'm novice in HotChocolate and I'm trying to PoC some simple usage.
I've created very simple .graphql file:
#camera.graphql
type Camera {
id: ID!
name: String!
}
type Query {
getCamera: Camera!
}
And a very simple .NET code for camera…

pvv
- 147
- 10
1
vote
1 answer
Is it possible to push a payload at time of subscription registration using HotChocolate?
Using hotchocolate graphql server 10.3.5 w/ pure-code-first. Clients currently query and subscribe to receive changes, works fine.
However, the query schema and subscription payload schema are often identical. I'd prefer that clients need only…

bunt
- 302
- 2
- 13
- 25
1
vote
1 answer
Hot Chocolate - Is it possible to implement my own object type with generics?
I wrote the following object type class.
public class ResponseType : ObjectType>
{
protected override void Configure(IObjectTypeDescriptor> descriptor)
{
descriptor.Name("Response");
}
}
I…

Brandon Taylor
- 65
- 1
- 9
1
vote
0 answers
Hotchocolate: Attaching field resolver with a flattened entity structure
I have my entities defined as
public class MyEntity
{
public string Id { get; set; }
public string Name { get; set; }
}
public class MyEntityDetails: MyEntity
{
public string ExtendedField1 { get; set; }
public string…

Victor Mukherjee
- 10,487
- 16
- 54
- 97