ASP.NET > GraphQL
graphql-dotnet/examples
startup.cs
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IDocumentExecuter, DocumentExecuter>();
var sp = services.BuildServiceProvider();
services.AddSingleton<ISchema>(new VivaSchema(new FuncDependencyResolver(type => sp.GetService(type))));
}
모델
Sckema
using GraphQL;
using GraphQL.Types;
namespace NHLStats.Api.Models
{
public class NHLStatsSchema : Schema
{
public NHLStatsSchema(IDependencyResolver resolver): base(resolver)
{
Query = resolver.Resolve<NHLStatsQuery>();
Mutation = resolver.Resolve<NHLStatsMutation>();
}
}
}
Query
Mutation
IPlayerRepository
PlayerType
query NHLStatsQuery($id: Int!){
player(id: $id){
id
}
}
PlayerRepository
Reference
이 문제에 관하여(ASP.NET > GraphQL), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/sugasaki/items/16897b0be4714d365b9f
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IDocumentExecuter, DocumentExecuter>();
var sp = services.BuildServiceProvider();
services.AddSingleton<ISchema>(new VivaSchema(new FuncDependencyResolver(type => sp.GetService(type))));
}
Sckema
using GraphQL;
using GraphQL.Types;
namespace NHLStats.Api.Models
{
public class NHLStatsSchema : Schema
{
public NHLStatsSchema(IDependencyResolver resolver): base(resolver)
{
Query = resolver.Resolve<NHLStatsQuery>();
Mutation = resolver.Resolve<NHLStatsMutation>();
}
}
}
Query
Mutation
IPlayerRepository
PlayerType
query NHLStatsQuery($id: Int!){
player(id: $id){
id
}
}
PlayerRepository
Reference
이 문제에 관하여(ASP.NET > GraphQL), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sugasaki/items/16897b0be4714d365b9f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)