CSHARP_CI Telegram 1433
🍫 Hot Chocolate + GraphQL + .NET: Быстрый старт

Если ты хочешь использовать GraphQL в .NET‑проектах — обрати внимание на Hot Chocolate от ChilliCream. Это мощный, удобный и активно развиваемый GraphQL-сервер для .NET.

📎 Полный гайд: [antondevtips.com/blog/getting-started-with-hot-chocolate-graphql](https://antondevtips.com/blog/getting-started-with-hot-chocolate-graphql)

⚙️ Шаг 1: Установка

Создай новый ASP.NET Core проект:


dotnet new web -n Demo
cd Demo
dotnet add package HotChocolate.AspNetCore


🧱 Шаг 2: Настройка GraphQL
В файле Program.cs добавь следующее:


var builder = WebApplication.CreateBuilder(args);

builder.Services
.AddGraphQLServer()
.AddQueryType<Query>();

var app = builder.Build();

app.MapGraphQL();
app.Run();

Создай класс Query.cs:



public class Query
{
public Book GetBook() => new Book
{
Title = "C# in Depth",
Author = new Author { Name = "Jon Skeet" }
};
}


И добавь модели:


public class Book
{
public string Title { get; set; }
public Author Author { get; set; }
}

public class Author
{
public string Name { get; set; }
}


📬 Шаг 3: Запрос в браузере
Открой http://localhost:5000/graphql и выполни GraphQL-запрос:



{
book {
title
author {
name
}
}
}

🧠 Почему стоит выбирать Hot Chocolate?

- Поддержка annotation-based, code-first и schema-first подходов

- Отличная интеграция с EF Core

- Встроенная фильтрация, сортировка, пагинация, DataLoader

- Поддержка подписок (Subscriptions)

- Интерактивная IDE: Banana Cake Pop

📌 Полезные советы
Для продакшена отключи Banana Cake Pop, GET-запросы и интроспекцию

Используй .AddMutationType, .AddSubscriptionType, .AddFiltering, .AddSorting для расширения схемы

🚀 Полный гайд

Hot Chocolate — это простой способ внедрить GraphQL в .NET. Он удобен в настройке, гибкий в использовании и подходит для проектов любого масштаба.



tgoop.com/csharp_ci/1433
Create:
Last Update:

🍫 Hot Chocolate + GraphQL + .NET: Быстрый старт

Если ты хочешь использовать GraphQL в .NET‑проектах — обрати внимание на Hot Chocolate от ChilliCream. Это мощный, удобный и активно развиваемый GraphQL-сервер для .NET.

📎 Полный гайд: [antondevtips.com/blog/getting-started-with-hot-chocolate-graphql](https://antondevtips.com/blog/getting-started-with-hot-chocolate-graphql)

⚙️ Шаг 1: Установка

Создай новый ASP.NET Core проект:


dotnet new web -n Demo
cd Demo
dotnet add package HotChocolate.AspNetCore


🧱 Шаг 2: Настройка GraphQL
В файле Program.cs добавь следующее:


var builder = WebApplication.CreateBuilder(args);

builder.Services
.AddGraphQLServer()
.AddQueryType<Query>();

var app = builder.Build();

app.MapGraphQL();
app.Run();

Создай класс Query.cs:



public class Query
{
public Book GetBook() => new Book
{
Title = "C# in Depth",
Author = new Author { Name = "Jon Skeet" }
};
}


И добавь модели:


public class Book
{
public string Title { get; set; }
public Author Author { get; set; }
}

public class Author
{
public string Name { get; set; }
}


📬 Шаг 3: Запрос в браузере
Открой http://localhost:5000/graphql и выполни GraphQL-запрос:



{
book {
title
author {
name
}
}
}

🧠 Почему стоит выбирать Hot Chocolate?

- Поддержка annotation-based, code-first и schema-first подходов

- Отличная интеграция с EF Core

- Встроенная фильтрация, сортировка, пагинация, DataLoader

- Поддержка подписок (Subscriptions)

- Интерактивная IDE: Banana Cake Pop

📌 Полезные советы
Для продакшена отключи Banana Cake Pop, GET-запросы и интроспекцию

Используй .AddMutationType, .AddSubscriptionType, .AddFiltering, .AddSorting для расширения схемы

🚀 Полный гайд

Hot Chocolate — это простой способ внедрить GraphQL в .NET. Он удобен в настройке, гибкий в использовании и подходит для проектов любого масштаба.

BY C# (C Sharp) programming








Share with your friend now:
tgoop.com/csharp_ci/1433

View MORE
Open in Telegram


Telegram News

Date: |

Avoid compound hashtags that consist of several words. If you have a hashtag like #marketingnewsinusa, split it into smaller hashtags: “#marketing, #news, #usa. Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau. Although some crypto traders have moved toward screaming as a coping mechanism, several mental health experts call this therapy a pseudoscience. The crypto community finds its way to engage in one or the other way and share its feelings with other fellow members. The imprisonment came as Telegram said it was "surprised" by claims that privacy commissioner Ada Chung Lai-ling is seeking to block the messaging app due to doxxing content targeting police and politicians. On June 7, Perekopsky met with Brazilian President Jair Bolsonaro, an avid user of the platform. According to the firm's VP, the main subject of the meeting was "freedom of expression."
from us


Telegram C# (C Sharp) programming
FROM American