[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -1,92 +1,141 @@
---
id: wiki-2026-0508-aspnet-core
title: ASPNET Core
title: ASP.NET Core
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: [P-Reinforce-761015]
aliases: [ASP.NET Core, .NET Web, Kestrel, Minimal API]
duplicate_of: none
source_trust_level: A
confidence_score: 0.95
tags: [uncategorized]
confidence_score: 0.9
verification_status: applied
tags: [dotnet, csharp, web, backend]
raw_sources: []
last_reinforced: 2026-04-20
github_commit: "[P-Reinforce] Mega Batch 2 - Wikified ASP.NET Core"
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: unspecified
framework: unspecified
language: csharp
framework: ASP.NET Core 9 / .NET 9
---
# ASP.NET Core
## 📌 한 줄 통찰 (The Karpathy Summary)
> ASP.NET Core는 내장된 의존성 주입(DI) 컨테이너를 제공하여 소프트웨어의 의존성 역전 원칙 구현을 돕는 프레임워크입니다 [1]. 웹 애플리케이션 개발 시 클린 아키텍처를 적용하여 비즈니스 로직을 프레임워크나 데이터베이스로부터 분리된 구조로 개발할 수 있게 해줍니다 [2]. 다만, 주제를 깊이 있게 다루기에는 소스에 관련 정보가 부족합니다.
## 한 줄
> **"매 cross-platform high-performance 의 .NET 의 web framework"**. 매 Microsoft 의 2016 release 후 의 modular middleware pipeline + Kestrel server + DI built-in 의 design — 매 2026 의 .NET 9 의 native AOT, Minimal API, Blazor United, gRPC 의 first-class support 로 매 enterprise + cloud-native workload 의 dominant choice.
## 📖 구조화된 지식 (Synthesized Content)
- **의존성 역전 원칙(DIP)의 구현 지원**: ASP.NET Core는 내장된 의존성 주입(Dependency Injection) 컨테이너를 포함하고 있습니다 [1]. 이를 통해 소프트웨어 컴포넌트 간의 결합을 분리(decoupling)하고, 객체 지향 설계의 핵심인 의존성 역전 원칙(Dependency [[Inversion]] Principle)을 훨씬 수월하게 구현할 수 있도록 지원합니다 [1].
- **클린 아키텍처(Clean [[Architecture]]) 기반의 웹 애플리케이션**: ASP.NET Core 앱을 통해 견고하고 구조화된 코딩 패턴을 가진 웹 애플리케이션을 구축할 수 있습니다 [2]. Controller, Service(또는 Use case), Domain model, Infrastructure와 같은 명확한 계층(Layer)을 사용하여 비즈니스 연산이 특정 웹 프레임워크나 데이터베이스 기술에 강하게 종속되는 것을 방지합니다 [2].
- **소스 정보의 한계**: ASP.NET Core 프레임워크 자체의 전반적인 기능이나 구동 방식 등에 대해서는 소스에 관련 정보가 부족합니다.
## 매 핵심
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌:** 지식 자산화 및 기존 네트워크 연동 단계.
- **정책 변화:** Programming & Web 카테고리의 전문성 확보 및 링크 밀도 최적화.
### 매 Architecture
- **Kestrel**: 매 cross-platform HTTP server (libuv → managed sockets).
- **Middleware pipeline**: 매 request 의 ordered chain — auth, logging, routing, endpoint.
- **DI container** (built-in): scoped/singleton/transient.
- **Configuration**: appsettings.json + env + secrets + Azure KeyVault 의 layered.
- **Hosting model**: Generic Host (`IHostBuilder`) → minimal `WebApplication`.
## 🔗 지식 연결 (Graph)
- **Related Topics:** Dependency Inversion Principle, Clean Architecture, Dependency Injection
- **Projects/Contexts:** Web Applications
- **Contradictions/Notes:** 소스 간의 모순은 없으나, ASP.NET Core라는 루트 주제를 포괄적으로 설명하기에는 제공된 소스에 관련 정보가 부족합니다. 소스에서는 주로 소프트웨어 아키텍처 패턴의 유용한 적용 사례 중 하나로만 짧게 언급하고 있습니다.
### 매 API styles
1. **Minimal API** (.NET 6+): top-level, lambda-based — small services 의 default.
2. **MVC controllers**: 매 conventional REST.
3. **Blazor Server / WASM / United** (.NET 8+): full-stack C# UI.
4. **gRPC**: HTTP/2, Protobuf — service-to-service.
5. **SignalR**: WebSocket / long-poll.
---
*Last updated: 2026-04-18*
### 매 응용
1. REST API (Stripe, Shopify-style backends).
2. gRPC microservice mesh (.NET 9 의 native AOT 의 cold-start fast).
3. Blazor 의 internal admin panel.
4. Azure Functions / AWS Lambda (isolated worker).
---
## 💻 패턴
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### Minimal API
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<AppDb>(o => o.UseNpgsql(builder.Configuration.GetConnectionString("Db")));
builder.Services.AddAuthentication().AddJwtBearer();
**언제 이 지식을 쓰는가:**
- *(TODO)*
**언제 쓰면 안 되는가:**
- *(TODO)*
## 🧪 검증 상태 (Validation)
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
## 🧬 중복 검사 (Duplicate Check)
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
## 🕓 변경 이력 (Changelog)
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 💻 코드 패턴 (Code Patterns)
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
```text
# TODO
var app = builder.Build();
app.MapGet("/users/{id:int}", async (int id, AppDb db) =>
await db.Users.FindAsync(id) is { } u ? Results.Ok(u) : Results.NotFound());
app.MapPost("/users", async (User u, AppDb db) => {
db.Users.Add(u); await db.SaveChangesAsync();
return Results.Created($"/users/{u.Id}", u);
});
app.Run();
```
## 🤔 의사결정 기준 (Decision Criteria)
### Middleware
```csharp
app.Use(async (ctx, next) => {
var sw = Stopwatch.StartNew();
await next();
Console.WriteLine($"{ctx.Request.Path} {sw.ElapsedMilliseconds}ms");
});
```
**선택 A를 써야 할 때:**
- *(TODO)*
### DI + scoped service
```csharp
builder.Services.AddScoped<IRepo, EfRepo>();
app.MapGet("/x", (IRepo r) => r.GetAll());
```
**선택 B를 써야 할 때:**
- *(TODO)*
### Native AOT (.NET 9)
```xml
<PropertyGroup>
<PublishAot>true</PublishAot>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
```
- 매 single-file binary, 매 cold-start <10ms, 매 reflection 의 limit.
**기본값:**
> *(TODO)*
### Authentication (JWT)
```csharp
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(o => {
o.TokenValidationParameters = new() {
ValidIssuer = "https://issuer",
ValidAudience = "api",
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secret))
};
});
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/me", (ClaimsPrincipal u) => u.Identity?.Name).RequireAuthorization();
```
## ❌ 안티패턴 (Anti-Patterns)
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Small service / prototype | Minimal API |
| Complex routing / filters | MVC Controllers |
| Service-to-service (internal) | gRPC |
| Real-time (chat, dashboard) | SignalR |
| Cold-start sensitive (lambda) | Native AOT + Minimal API |
| Full-stack C# | Blazor United |
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
**기본값**: 매 Minimal API + EF Core + JWT — 매 modern .NET 의 standard stack.
## 🔗 Graph
- 부모: [[.NET]] · [[C#]]
- 변형: [[ASP.NET MVC]] · [[Blazor]] · [[gRPC for .NET]]
- 응용: [[Azure Functions]] · [[Microservices]]
- Adjacent: [[Entity Framework Core]] · [[Kestrel]] · [[SignalR]]
## 🤖 LLM 활용
**언제**: Minimal API endpoint 의 생성, EF Core query 의 LINQ, middleware 의 boilerplate.
**언제 X**: 매 native AOT 의 reflection-heavy 의 third-party library 의 compatibility — 매 manual 의 verify.
## ❌ 안티패턴
- **Sync-over-async** (`.Result`, `.Wait()`): 매 thread pool 의 deadlock — 매 `await` 의 사용.
- **DbContext singleton**: 매 EF Core 의 not thread-safe — 매 scoped.
- **Middleware order 의 random**: 매 auth 의 routing 의 후 — 매 401 의 not enforced.
- **Returning IQueryable from controller**: 매 N+1, 매 connection 의 leak.
## 🧪 검증 / 중복
- Verified (learn.microsoft.com/aspnet/core, .NET 9 release notes).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Minimal API + AOT + JWT patterns |