CSHARP_CI Telegram 1434
🍫 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/1434
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/1434

View MORE
Open in Telegram


Telegram News

Date: |

The group’s featured image is of a Pepe frog yelling, often referred to as the “REEEEEEE” meme. Pepe the Frog was created back in 2005 by Matt Furie and has since become an internet symbol for meme culture and “degen” culture. As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.” As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces. Public channels are public to the internet, regardless of whether or not they are subscribed. A public channel is displayed in search results and has a short address (link). But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered."
from us


Telegram C# (C Sharp) programming
FROM American