{"id":400644,"date":"2024-06-29T15:23:14","date_gmt":"2024-06-29T15:23:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=400644"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=400644","title":{"rendered":"<span>GraphQL \u0432 .NET: \u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0430 GraphQL.<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 graphQL, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, <a href=\"https:\/\/www.c-sharpcorner.com\/article\/graphql-in-net-introduction\/\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 graphQL <a href=\"https:\/\/www.c-sharpcorner.com\/article\/graphql-in-net-practical-usage\/\">\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 GraphQL \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IQueryable<\/code>. \u041d\u0430\u0448 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/TuralSuleymani\/WorkingWithGraphQL\">\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> (<code>002_GraphQLWithEFCore<\/code>) \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f GraphQL \u0441 EF Core (Entity Framework (EF) Core \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c Entity Framework \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c).<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0432\u0435\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e Customer (\u043a\u043b\u0438\u0435\u043d\u0442) \u0438 Card (\u043a\u0430\u0440\u0442\u0430) \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e EF Core.<\/p>\n<pre><code class=\"cs\">public class Customer {     public int Id { get; set; }     public string Name { get; set; }     public string Email { get; set; }     public List&lt;Card> Cards { get; set; } }  public class Card {     public int Id { get; set; }     public string Number { get; set; }     public string CVC { get; set; }     public string ExpiryDate { get; set; }     public int CustomerId { get; set; }     public Customer Customer { get; set; } }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c DbContext:<\/p>\n<pre><code class=\"cs\">public class GraphQLAppDbContext : DbContext {     public GraphQLAppDbContext(DbContextOptions&lt;GraphQLAppDbContext> options) : base(options) { }      public DbSet&lt;Customer> Customers { get; set; }     public DbSet&lt;Card> Cards { get; set; }      protected override void OnModelCreating(ModelBuilder modelBuilder)     {         modelBuilder.Entity&lt;Customer>()             .HasMany(e => e.Cards)             .WithOne(x => x.Customer)             .HasForeignKey(x => x.CustomerId)             .IsRequired();          modelBuilder.Entity&lt;Customer>()             .HasData(new Customer() { Id = 1, Email = \"id1@gmail.com\", Name = \"Simon Baker\" },                      new Customer() { Id = 2, Email = \"id2@gmail.com\", Name = \"Hanayama Kaoru\" },                      new Customer() { Id = 3, Email = \"id3@gmail.com\", Name = \"Hanma Baki\" },                      new Customer() { Id = 4, Email = \"id4@gmail.com\", Name = \"O. Doppo\" });          modelBuilder.Entity&lt;Card>()             .HasData(new Card() { Id = 1, CustomerId = 1, Number = \"1234-2345-3445-3456\", CVC = \"345\", ExpiryDate = \"08\/26\" },                      new Card() { Id = 2, CustomerId = 2, Number = \"1234-2345-3445-3456\", CVC = \"345\", ExpiryDate = \"08\/26\" },                      new Card() { Id = 3, CustomerId = 3, Number = \"3344-7654-3445-3456\", CVC = \"123\", ExpiryDate = \"09\/25\" },                      new Card() { Id = 4, CustomerId = 4, Number = \"5566-5454-3445-3456\", CVC = \"234\", ExpiryDate = \"07\/24\" },                      new Card() { Id = 5, CustomerId = 1, Number = \"6677-3232-3445-3456\", CVC = \"987\", ExpiryDate = \"06\/26\" },                      new Card() { Id = 6, CustomerId = 1, Number = \"8899-9898-3445-3456\", CVC = \"654\", ExpiryDate = \"05\/27\" },                      new Card() { Id = 7, CustomerId = 2, Number = \"9900-5678-3445-3456\", CVC = \"432\", ExpiryDate = \"04\/28\" },                      new Card() { Id = 8, CustomerId = 1, Number = \"1122-5678-3445-3456\", CVC = \"165\", ExpiryDate = \"03\/23\" },                      new Card() { Id = 9, CustomerId = 2, Number = \"2233-2543-3445-3456\", CVC = \"651\", ExpiryDate = \"02\/29\" },                      new Card() { Id = 10, CustomerId = 3, Number = \"3544-1234-3445-3456\", CVC = \"987\", ExpiryDate = \"01\/26\" });          base.OnModelCreating(modelBuilder);     } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448 Query resolver (\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432). (\u043a\u043e\u0434)<\/p>\n<pre><code class=\"cs\">public class Query {     public IQueryable&lt;Customer> GetCustomers([Service] GraphQLAppDbContext graphqldbcontext)     => graphqldbcontext.Customers.Include(\"Cards\"); }<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c hotchocolate, \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"cs\">using _002_GraphQLWithEFCore.Database; using _002_GraphQLWithEFCore.Queries;  using Microsoft.EntityFrameworkCore;  var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext&lt;GraphQLAppDbContext>(         options => options.UseSqlServer(\"Data Source=.;Initial Catalog=GraphQLDb;Integrated Security=SSPI;TrustServerCertificate=True;\"));  builder.Services.AddGraphQLServer()     .AddQueryType&lt;Query>();  var app = builder.Build();  app.MapGraphQL();  app.Run();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0438 \u0435\u0433\u043e \u043a\u0430\u0440\u0442\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/41a\/223\/c24\/41a223c24b2d9a53b43a0d791e767f6a.png\" width=\"700\" height=\"384\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/41a\/223\/c24\/41a223c24b2d9a53b43a0d791e767f6a.png\"\/><\/figure>\n<h3>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u0432 GraphQL<\/h3>\n<p>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0438 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c, \u0430 \u043d\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0444\u043e\u0440\u043c\u044b \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 2 \u0432\u0438\u0434\u0430:<\/p>\n<h4>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/h4>\n<p>\u042d\u0442\u043e \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0441 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 Skip-Take, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 EF Core. \u041d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0442\u043e\u043f-10 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438; \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0436\u0435 10 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 10-\u044e \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438. (\u043c\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f77\/be6\/5d1\/f77be65d1ef9c3f7476831792ac4ecb7.png\" width=\"700\" height=\"431\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f77\/be6\/5d1\/f77be65d1ef9c3f7476831792ac4ecb7.png\"\/><\/figure>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, skip(3).Take(3) \u0432\u0435\u0440\u043d\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b <strong>[ 8, 7, 6 ]<\/strong>, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 (<strong>\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 2<\/strong>), \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u0430, \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Skip(3).Take(3). ( <strong>[ 9, 8, 7]<\/strong> )<\/p>\n<h4>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430<\/h4>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 (\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u0442 id), \u043e\u043d\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0442\u0438\u043f\u0430 <code>\"give 5 elements after id=7\"<\/code> (\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c 5 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 id=7).<\/p>\n<p>GrahpQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 hot chocolate \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>[UsePaging]<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\/\u0440\u0435\u0437\u043e\u043b\u044c\u0432\u0435\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<pre><code class=\"cs\">public class Query {     [UsePaging(MaxPageSize = 2)]     public IQueryable&lt;Customer> GetCustomers([Service] GraphQLAppDbContext graphqldbcontext)     => graphqldbcontext.Customers.Include(\"Cards\"); }<\/code><\/pre>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e graphQL \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 10 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>MaxPagesize<\/code>. \u0415\u0441\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0445\u0435\u043c\u0443 graphQL \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 UsePaging, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u043d\u0435\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e49\/17b\/7bb\/e4917b7bb10ca009709a4a0b4b07f4b6.png\" width=\"700\" height=\"229\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e49\/17b\/7bb\/e4917b7bb10ca009709a4a0b4b07f4b6.png\"\/><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438, \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <strong>pageInfo<\/strong>, \u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>nodes<\/strong> (\u0443\u0437\u043b\u044b).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4cd\/b47\/0a7\/4cdb470a79d5db39232c1867a7db96e7.png\" width=\"700\" height=\"256\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4cd\/b47\/0a7\/4cdb470a79d5db39232c1867a7db96e7.png\"\/><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0443\u0440\u0441\u043e\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043a <strong>endcursor<\/strong>, \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/2dd\/65a\/7f4\/2dd65a7f4cf2787c34c31a407840b727.jpg\" width=\"700\" height=\"236\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2dd\/65a\/7f4\/2dd65a7f4cf2787c34c31a407840b727.jpg\" data-blurred=\"true\"\/><\/figure>\n<hr\/>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 <a href=\"https:\/\/otus.pw\/E7rH\/\">\u043a\u0443\u0440\u0441\u0430 &#171;C# Developer. Professional&#187;.<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/749272\/\"> https:\/\/habr.com\/ru\/articles\/749272\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0430 GraphQL.<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 graphQL, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, <a href=\"https:\/\/www.c-sharpcorner.com\/article\/graphql-in-net-introduction\/\">\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439<\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 graphQL <a href=\"https:\/\/www.c-sharpcorner.com\/article\/graphql-in-net-practical-usage\/\">\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 GraphQL \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IQueryable<\/code>. \u041d\u0430\u0448 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/TuralSuleymani\/WorkingWithGraphQL\">\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> (<code>002_GraphQLWithEFCore<\/code>) \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f GraphQL \u0441 EF Core (Entity Framework (EF) Core \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0439 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c Entity Framework \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c).<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0432\u0435\u0434\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e Customer (\u043a\u043b\u0438\u0435\u043d\u0442) \u0438 Card (\u043a\u0430\u0440\u0442\u0430) \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e EF Core.<\/p>\n<pre><code class=\"cs\">public class Customer {     public int Id { get; set; }     public string Name { get; set; }     public string Email { get; set; }     public List&lt;Card> Cards { get; set; } }  public class Card {     public int Id { get; set; }     public string Number { get; set; }     public string CVC { get; set; }     public string ExpiryDate { get; set; }     public int CustomerId { get; set; }     public Customer Customer { get; set; } }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c DbContext:<\/p>\n<pre><code class=\"cs\">public class GraphQLAppDbContext : DbContext {     public GraphQLAppDbContext(DbContextOptions&lt;GraphQLAppDbContext> options) : base(options) { }      public DbSet&lt;Customer> Customers { get; set; }     public DbSet&lt;Card> Cards { get; set; }      protected override void OnModelCreating(ModelBuilder modelBuilder)     {         modelBuilder.Entity&lt;Customer>()             .HasMany(e => e.Cards)             .WithOne(x => x.Customer)             .HasForeignKey(x => x.CustomerId)             .IsRequired();          modelBuilder.Entity&lt;Customer>()             .HasData(new Customer() { Id = 1, Email = \"id1@gmail.com\", Name = \"Simon Baker\" },                      new Customer() { Id = 2, Email = \"id2@gmail.com\", Name = \"Hanayama Kaoru\" },                      new Customer() { Id = 3, Email = \"id3@gmail.com\", Name = \"Hanma Baki\" },                      new Customer() { Id = 4, Email = \"id4@gmail.com\", Name = \"O. Doppo\" });          modelBuilder.Entity&lt;Card>()             .HasData(new Card() { Id = 1, CustomerId = 1, Number = \"1234-2345-3445-3456\", CVC = \"345\", ExpiryDate = \"08\/26\" },                      new Card() { Id = 2, CustomerId = 2, Number = \"1234-2345-3445-3456\", CVC = \"345\", ExpiryDate = \"08\/26\" },                      new Card() { Id = 3, CustomerId = 3, Number = \"3344-7654-3445-3456\", CVC = \"123\", ExpiryDate = \"09\/25\" },                      new Card() { Id = 4, CustomerId = 4, Number = \"5566-5454-3445-3456\", CVC = \"234\", ExpiryDate = \"07\/24\" },                      new Card() { Id = 5, CustomerId = 1, Number = \"6677-3232-3445-3456\", CVC = \"987\", ExpiryDate = \"06\/26\" },                      new Card() { Id = 6, CustomerId = 1, Number = \"8899-9898-3445-3456\", CVC = \"654\", ExpiryDate = \"05\/27\" },                      new Card() { Id = 7, CustomerId = 2, Number = \"9900-5678-3445-3456\", CVC = \"432\", ExpiryDate = \"04\/28\" },                      new Card() { Id = 8, CustomerId = 1, Number = \"1122-5678-3445-3456\", CVC = \"165\", ExpiryDate = \"03\/23\" },                      new Card() { Id = 9, CustomerId = 2, Number = \"2233-2543-3445-3456\", CVC = \"651\", ExpiryDate = \"02\/29\" },                      new Card() { Id = 10, CustomerId = 3, Number = \"3544-1234-3445-3456\", CVC = \"987\", ExpiryDate = \"01\/26\" });          base.OnModelCreating(modelBuilder);     } }<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043d\u0430\u0448 Query resolver (\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432). (\u043a\u043e\u0434)<\/p>\n<pre><code class=\"cs\">public class Query {     public IQueryable&lt;Customer> GetCustomers([Service] GraphQLAppDbContext graphqldbcontext)     => graphqldbcontext.Customers.Include(\"Cards\"); }<\/code><\/pre>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c hotchocolate, \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<pre><code class=\"cs\">using _002_GraphQLWithEFCore.Database; using _002_GraphQLWithEFCore.Queries;  using Microsoft.EntityFrameworkCore;  var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext&lt;GraphQLAppDbContext>(         options => options.UseSqlServer(\"Data Source=.;Initial Catalog=GraphQLDb;Integrated Security=SSPI;TrustServerCertificate=True;\"));  builder.Services.AddGraphQLServer()     .AddQueryType&lt;Query>();  var app = builder.Build();  app.MapGraphQL();  app.Run();<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0438 \u0435\u0433\u043e \u043a\u0430\u0440\u0442\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u0432 GraphQL<\/h3>\n<p>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0438 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c, \u0430 \u043d\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0444\u043e\u0440\u043c\u044b \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u043d\u0430 2 \u0432\u0438\u0434\u0430:<\/p>\n<h4>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/h4>\n<p>\u042d\u0442\u043e \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0441 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0435\u0439 Skip-Take, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 EF Core. \u041d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0442\u043e\u043f-10 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438; \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0436\u0435 10 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 10-\u044e \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438. (\u043c\u044b \u043d\u0435 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c).<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, skip(3).Take(3) \u0432\u0435\u0440\u043d\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b <strong>[ 8, 7, 6 ]<\/strong>, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 (<strong>\u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 2<\/strong>), \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u0430, \u043c\u044b \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Skip(3).Take(3). ( <strong>[ 9, 8, 7]<\/strong> )<\/p>\n<h4>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430<\/h4>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0430 \u0444\u043e\u0440\u043c\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 (\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u0442 id), \u043e\u043d\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u0435\u0440\u0435\u0434. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0432\u044b\u0448\u0435\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0442\u0438\u043f\u0430 <code>\"give 5 elements after id=7\"<\/code> (\u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c 5 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 id=7).<\/p>\n<p>GrahpQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 hot chocolate \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0412\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>[UsePaging]<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438\/\u0440\u0435\u0437\u043e\u043b\u044c\u0432\u0435\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<pre><code class=\"cs\">public class Query {     [UsePaging(MaxPageSize = 2)]     public IQueryable&lt;Customer> GetCustomers([Service] GraphQLAppDbContext graphqldbcontext)     => graphqldbcontext.Customers.Include(\"Cards\"); }<\/code><\/pre>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e graphQL \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 10 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <code>MaxPagesize<\/code>. \u0415\u0441\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0445\u0435\u043c\u0443 graphQL \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 UsePaging, \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u043d\u0435\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438, \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <strong>pageInfo<\/strong>, \u0430 \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <strong>nodes<\/strong> (\u0443\u0437\u043b\u044b).<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0443\u0440\u0441\u043e\u0440\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u043a <strong>endcursor<\/strong>, \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<hr\/>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u043f\u0440\u0435\u0434\u0434\u0432\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0440\u0442\u0430 <a href=\"https:\/\/otus.pw\/E7rH\/\">\u043a\u0443\u0440\u0441\u0430 &#171;C# Developer. Professional&#187;.<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/749272\/\"> https:\/\/habr.com\/ru\/articles\/749272\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-400644","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/400644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=400644"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/400644\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=400644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=400644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=400644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}