mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
feat(generator): 添加配置架构集成测试和JSON模式配置生成器
- 添加 ArchitectureConfigIntegrationTests 测试验证配置注册表初始化功能 - 实现 SchemaConfigGenerator 源代码生成器解析JSON schema文件 - 生成配置类型类、配置表包装器和运行时绑定辅助代码 - 支持嵌套对象、对象数组、标量数组的类型安全访问 - 提供强类型的配置表查询方法如 FindByProperty 等 - 实现跨表引用元数据生成和验证机制
This commit is contained in:
parent
2b30e859e9
commit
7fad6772e0
@ -86,6 +86,10 @@ public class ArchitectureConfigIntegrationTests
|
||||
{
|
||||
// Ignored: cleanup is best effort and should not fail the test.
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
// Ignored: cleanup is best effort and can transiently fail when files are still being released.
|
||||
}
|
||||
}
|
||||
|
||||
private const string MonsterSchemaJson = @"{
|
||||
|
||||
@ -345,6 +345,10 @@ public class SchemaConfigGeneratorTests
|
||||
Assert.That(tableSource, Does.Not.Contain("FindByDropItems("));
|
||||
Assert.That(tableSource, Does.Not.Contain("FindByTargetId("));
|
||||
Assert.That(tableSource, Does.Not.Contain("FindByReward("));
|
||||
Assert.That(tableSource, Does.Not.Contain("TryFindFirstById("));
|
||||
Assert.That(tableSource, Does.Not.Contain("TryFindFirstByDropItems("));
|
||||
Assert.That(tableSource, Does.Not.Contain("TryFindFirstByTargetId("));
|
||||
Assert.That(tableSource, Does.Not.Contain("TryFindFirstByReward("));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1043,7 +1043,7 @@ public sealed class SchemaConfigGenerator : IIncrementalGenerator
|
||||
builder.AppendLine();
|
||||
builder.AppendLine(
|
||||
" // Scan the current table snapshot on demand so generated helpers stay aligned with reloadable runtime data.");
|
||||
builder.AppendLine($" foreach (var candidate in All())");
|
||||
builder.AppendLine(" foreach (var candidate in All())");
|
||||
builder.AppendLine(" {");
|
||||
builder.AppendLine(
|
||||
$" if (global::System.Collections.Generic.EqualityComparer<{property.TypeSpec.ClrType}>.Default.Equals(candidate.{property.PropertyName}, value))");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user