Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User context docs update #2846

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

decembrya
Copy link
Contributor

No description provided.

@@ -28,3 +28,20 @@ public class Query : ObjectGraphType
}
}
```

If you need to access the User from the http request and populate this globally, you will need to add a User property to your custom `UserContext` class and modify your Startup configuration as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

populate this globally

What does globally mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this, adjusted the wording and added the other changes suggested.

@@ -28,3 +28,20 @@ public class Query : ObjectGraphType
}
}
```

If you need to access the User from the http request and populate this globally, you will need to add a User property to your custom `UserContext` class and modify your Startup configuration as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to add a User property

or just

var context = new MyGraphQLUserContext(); // or even Dictionary<string, object?>();
context["User"] = user;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I would change wording from will need to to may.

}

services.AddGraphQL()
.AddUserContextBuilder(httpContext => new MyGraphQLUserContext(httpContext.User));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such method in this repo. It's method from server project. Worth to note explicitly.

@sungam3r
Copy link
Member

@Shane32 Merge if OK.

@Shane32 Shane32 merged commit e6ec3fa into graphql-dotnet:master Jan 12, 2022
@decembrya decembrya deleted the user-context-docs-update branch January 13, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants