Fix MinimalApi to resolve authorization services per-request

- Resolve ICommandAuthorizationService and IQueryAuthorizationService from request-scoped serviceProvider
- Allows Scoped authorization services that depend on DbContext
- Updated both MinimalApi and DynamicQuery.MinimalApi

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-14 15:56:31 -05:00
parent bd43bc9bde
commit 227be70f95
8 changed files with 429 additions and 63 deletions
+6 -11
View File
@@ -159,7 +159,10 @@ internal static class ProtoFileTypeMapper
}
/// <summary>
/// Converts C# PascalCase property name to proto snake_case field name
/// Converts C# PascalCase property name to proto snake_case field name.
/// Uses simple conversion: add underscore before each uppercase letter (except first).
/// This matches protobuf's C# codegen expectations for PascalCase conversion.
/// Example: TotalADeduire -> total_a_deduire -> TotalADeduire (in generated C#)
/// </summary>
public static string ToSnakeCase(string pascalCase)
{
@@ -174,16 +177,8 @@ internal static class ProtoFileTypeMapper
var c = pascalCase[i];
if (char.IsUpper(c))
{
// Handle sequences of uppercase letters (e.g., "APIKey" -> "api_key")
if (i + 1 < pascalCase.Length && char.IsUpper(pascalCase[i + 1]))
{
result.Append(char.ToLowerInvariant(c));
}
else
{
result.Append('_');
result.Append(char.ToLowerInvariant(c));
}
result.Append('_');
result.Append(char.ToLowerInvariant(c));
}
else
{