Files
everything-claude-code/docs/ja-JP/rules/csharp/patterns.md
Claude ec9ace9c54 docs: add native Japanese translation of ECC documentation (ja-JP)
Translate everything-claude-code repository to Japanese including:
- 17 root documentation files
- 60 agent documentation files
- 80 command documentation files
- 99 rule files across 18 language directories (common, angular, arkts, cpp, csharp, dart, fsharp, golang, java, kotlin, perl, php, python, ruby, rust, swift, typescript, web)
- 199 skill documentation files

Total: 455 files translated to Japanese with:
- Consistent terminology glossary applied throughout
- YAML field names preserved in English (name, description, etc.)
- Code blocks and examples untouched (comments translated)
- Markdown structure and relative links preserved
- Professional translation maintaining technical accuracy

This translation expands ECC accessibility to Japanese-speaking developers and teams.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-17 02:31:40 -04:00

51 lines
1.6 KiB
Markdown

---
paths:
- "**/*.cs"
- "**/*.csx"
---
# C# パターン
> このファイルは [common/patterns.md](../common/patterns.md) を C# 固有のコンテンツで拡張します。
## API レスポンスパターン
```csharp
public sealed record ApiResponse<T>(
bool Success,
T? Data = default,
string? Error = null,
object? Meta = null);
```
## リポジトリパターン
```csharp
public interface IRepository<T>
{
Task<IReadOnlyList<T>> FindAllAsync(CancellationToken cancellationToken);
Task<T?> FindByIdAsync(Guid id, CancellationToken cancellationToken);
Task<T> CreateAsync(T entity, CancellationToken cancellationToken);
Task<T> UpdateAsync(T entity, CancellationToken cancellationToken);
Task DeleteAsync(Guid id, CancellationToken cancellationToken);
}
```
## オプションパターン
コードベース全体で生の文字列を読み取る代わりに、設定に強く型付けされたオプションを使用する。
```csharp
public sealed class PaymentsOptions
{
public const string SectionName = "Payments";
public required string BaseUrl { get; init; }
public required string ApiKeySecretName { get; init; }
}
```
## 依存性注入
- サービス境界でインターフェースに依存する
- コンストラクタを集中させる。サービスに依存関係が多すぎる場合は責任を分割する
- ライフタイムを意図的に登録する: ステートレス/共有サービスにはシングルトン、リクエストデータにはスコープ、軽量な純粋ワーカーにはトランジエント