Skip to content

Commit 8b33012

Browse files
committed
fix
1 parent bade67a commit 8b33012

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/CodeGenerators/Models/ModelGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public async Task<SourceText> GetModelTextForStoredProcedureAsync(Definition.Sch
5454
bool loneIsNVarChar = loneCol != null && (loneCol.SqlTypeName?.StartsWith("nvarchar", System.StringComparison.OrdinalIgnoreCase) ?? false);
5555
bool noJsonRoot = !(currentSet?.JsonRootProperty?.Length > 0);
5656
bool flatJsonPath = loneCol != null && loneCol.IsNestedJson != true; // flattened model: treat as flat when not nested
57-
bool legacyJsonSentinel = loneCol != null && loneCol.Name.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", System.StringComparison.OrdinalIgnoreCase);
57+
bool legacyJsonSentinel = loneCol?.Name?.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", System.StringComparison.OrdinalIgnoreCase) ?? false;
5858
if (isCrudVerbName && singlePseudoColumn && loneIsNVarChar && noJsonRoot && flatJsonPath && !legacyJsonSentinel)
5959
{
6060
consoleService.Verbose($"[model-skip] Suppressed model for CRUD '{storedProcedure.Name}' (pseudo single nvarchar column) – using Output only.");
@@ -535,7 +535,7 @@ private async Task WriteSingleModelAsync(Definition.Schema schema, Definition.St
535535
bool loneIsNVarChar2 = loneCol2 != null && (loneCol2.SqlTypeName?.StartsWith("nvarchar", System.StringComparison.OrdinalIgnoreCase) ?? false);
536536
bool noJsonRoot2 = !(currentSet?.JsonRootProperty?.Length > 0);
537537
bool flatJsonPath2 = loneCol2 != null && loneCol2.IsNestedJson != true;
538-
bool legacyJsonSentinel2 = loneCol2 != null && loneCol2.Name.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", System.StringComparison.OrdinalIgnoreCase);
538+
bool legacyJsonSentinel2 = loneCol2?.Name?.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", System.StringComparison.OrdinalIgnoreCase) ?? false;
539539
if (isCrudVerbName2 && singlePseudoColumn2 && loneIsNVarChar2 && noJsonRoot2 && flatJsonPath2 && !legacyJsonSentinel2)
540540
{
541541
consoleService.Verbose($"[model-skip] Suppressed model write for CRUD '{storedProcedure.Name}' (pseudo single nvarchar column) – Output only.");

src/CodeGenerators/Models/StoredProcedureGenerator.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public async Task<SourceText> GetStoredProcedureExtensionsCodeAsync(Definition.S
6262
}
6363

6464
// Determine if any stored procedure in this group actually produces a model (skip pure scalar non-JSON procs)
65-
// Unabhängig vom Modus: JSON Procs erzeugen ausschließlich Raw Methoden (Task<string>), niemals typed Models oder Deserialize Methoden.
66-
var genMode = Environment.GetEnvironmentVariable("SPOCR_GENERATOR_MODE")?.Trim().ToLowerInvariant() ?? "dual"; // read but no behavioral effect for JSON typing
67-
bool legacyRawJsonOnly = true; // force raw-only for JSON always
65+
// Unabhängig vom Modus: JSON Procs erzeugen ausschließlich Raw Methoden (Task<string>), niemals typed Models oder Deserialize Methoden.
66+
var genMode = Environment.GetEnvironmentVariable("SPOCR_GENERATOR_MODE")?.Trim().ToLowerInvariant() ?? "dual"; // read but no behavioral effect for JSON typing
67+
bool legacyRawJsonOnly = true; // force raw-only for JSON always
6868
bool NeedsModel(Definition.StoredProcedure sp)
6969
{
7070
if (sp.ResultSets == null || sp.ResultSets.Count == 0) return false;
@@ -317,8 +317,8 @@ bool IsPseudoTabularCrud(Definition.StoredProcedure sp, StoredProcedureContentMo
317317
bool loneIsNVarChar = (lone.SqlTypeName?.StartsWith("nvarchar", StringComparison.OrdinalIgnoreCase) ?? false);
318318
bool noRoot = !(set.JsonRootProperty?.Length > 0);
319319
// JsonPath removed – treat as flat if no nested JSON columns
320-
bool flatPath = (lone.IsNestedJson != true);
321-
bool legacyJsonSentinel = lone.Name.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", StringComparison.OrdinalIgnoreCase);
320+
bool flatPath = lone.IsNestedJson != true;
321+
bool legacyJsonSentinel = lone?.Name?.Equals("JSON_F52E2B61-18A1-11d1-B105-00805F49916B", StringComparison.OrdinalIgnoreCase) ?? false;
322322
// Rein strukturelle Heuristik: Einzelne nvarchar(max) Spalte ohne Root/verschachtelten Pfad -> pseudo tabular
323323
return loneIsNVarChar && noRoot && flatPath && !legacyJsonSentinel;
324324
}
@@ -494,8 +494,8 @@ bool IsPseudoTabularCrud(Definition.StoredProcedure sp, StoredProcedureContentMo
494494
}
495495
}
496496

497-
// Deserialize Pfad entfernt -> requiresAsync immer false
498-
var requiresAsync = false;
497+
// Deserialize Pfad entfernt -> requiresAsync immer false
498+
var requiresAsync = false;
499499

500500
var rawJson = false;
501501
// Special case: multiple result sets but exactly one JSON set -> treat JSON as primary

0 commit comments

Comments
 (0)