graphql-dotnet

Enable Synchronous IO in Azure Function

狂风中的少年 提交于 2020-05-15 09:09:13
问题 I am building a HTTPTriggered Azure Function, targeting netcoreapp3.0, that is running a GraphQL .NET server. GraphQL .NET requires that AllowSynchronousIO is set to true , but I can't figure out how to do that for a Azure Function. I have tried implementing my own Startup class that extends FunctionsStartup and added the below code in the Configure method with no luck. builder.Services .AddOptions<KestrelServerOptions>() .Configure<IConfiguration>((settings, configuration) => { settings

How to handle concurrent DbContext access in dataloaders / GraphQL nested queries?

孤者浪人 提交于 2020-05-09 05:41:52
问题 I'm using a couple of dataloaders that use injected query services (which in turn have dependencies on a DbContext). It looks something like this: Field<ListGraphType<UserType>>( "Users", resolve: context => { var loader = accessor.Context.GetOrAddBatchLoader<Guid, IEnumerable<User>>( "MyUserLoader", userQueryService.MyUserFunc); return loader.LoadAsync(context.Source.UserId); }); Field<ListGraphType<GroupType>>( "Groups", resolve: context => { var loader = accessor.Context

How to implement authorization using GraphQL.NET at Resolver function level?

不打扰是莪最后的温柔 提交于 2020-02-28 06:41:09
问题 I am looking for sample code and examples regarding how to implement authorization at resolver function level using GraphQL.NET and ASP.NET CORE 2. Basically I am trying to prevent the execution of query if the request is not authorized. Can anyone help me to get some good tutorials or code samples as reference for the implementation. 回答1: For graphql-dotnet/authorization, the page for AspNetCore has not been released, refer Add GraphQL.Server.Authorization.AspNetCore NuGet package #171. You

Converting .NET Enum to GraphQL EnumerationGraphType

僤鯓⒐⒋嵵緔 提交于 2019-12-11 04:32:44
问题 How do I convert an enum to the EnumerationGraphType that GraphQL uses? Here is an example to illustrate what I'm talking about: public enum MeetingStatusType { Tentative, Unconfirmed, Confirmed, } public class MeetingDto { public string Id { get; set; } public string Name { get; set; } public MeetingStatusType Status { get; set; } } public class MeetingStatusEnumType : EnumerationGraphType<MeetingStatusType> { public MeetingStatusEnumType() { Name = "MeetingStatusType"; } } public class

Implement authorization on Fields using GraphQL.NET and ASP.NET Core 2

为君一笑 提交于 2019-12-11 01:43:25
问题 I have a existing REST API developed using ASP.NET WEB API 2 where the authorization is handled by storing all the controller name and action method details in a xml file. WebAPIAuthorization.xml: <?xml version="1.0" encoding="utf-8" ?> <WebApiAuthorizationSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <WebApiControllerAuthorizationSettings> <WebApiControllerAuthorizationSetting> <ControlerName>Profile</ControlerName>