mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
docs(source-generators): 添加源码生成器文档
- 新增 AutoRegisterExportedCollections 生成器文档 - 新增 AutoScene 生成器文档 - 新增 AutoUiPage 生成器文档 - 新增完整的源码生成器索引文档 - 详细介绍各生成器的使用方法和参数说明 - 提供生成代码示例和诊断信息说明 - 包含性能优势和使用示例章节
This commit is contained in:
parent
f9cc1237a3
commit
81897ce2ac
@ -359,6 +359,14 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试桩:异步发送 CQRS 命令并返回响应。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">命令响应类型。</typeparam>
|
||||||
|
/// <param name="command">要发送的命令。</param>
|
||||||
|
/// <param name="cancellationToken">取消令牌。</param>
|
||||||
|
/// <returns>命令响应任务。</returns>
|
||||||
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public ValueTask<TResponse> SendCommandAsync<TResponse>(
|
public ValueTask<TResponse> SendCommandAsync<TResponse>(
|
||||||
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
@ -366,11 +374,26 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试桩:同步发送 CQRS 命令并返回响应。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">命令响应类型。</typeparam>
|
||||||
|
/// <param name="command">要发送的命令。</param>
|
||||||
|
/// <returns>命令响应。</returns>
|
||||||
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
public TResponse SendCommand<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Command.ICommand<TResponse> command)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试桩:异步发送 CQRS 查询并返回结果。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">查询结果类型。</typeparam>
|
||||||
|
/// <param name="query">要发送的查询。</param>
|
||||||
|
/// <param name="cancellationToken">取消令牌。</param>
|
||||||
|
/// <returns>查询结果任务。</returns>
|
||||||
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public ValueTask<TResponse> SendQueryAsync<TResponse>(
|
public ValueTask<TResponse> SendQueryAsync<TResponse>(
|
||||||
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
@ -378,6 +401,13 @@ public class TestArchitectureContextV3 : IArchitectureContext
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 测试桩:同步发送 CQRS 查询并返回结果。
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TResponse">查询结果类型。</typeparam>
|
||||||
|
/// <param name="query">要发送的查询。</param>
|
||||||
|
/// <returns>查询结果。</returns>
|
||||||
|
/// <exception cref="NotImplementedException">该测试桩未实现此成员。</exception>
|
||||||
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
public TResponse SendQuery<TResponse>(GFramework.Cqrs.Abstractions.Cqrs.Query.IQuery<TResponse> query)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@ -35,16 +35,16 @@ public class MediatorCompatibilityDeprecationTests
|
|||||||
{
|
{
|
||||||
AssertLegacyType(
|
AssertLegacyType(
|
||||||
typeof(ContextAwareMediatorExtensions),
|
typeof(ContextAwareMediatorExtensions),
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsExtensions instead.");
|
"Use GFramework.Core.Extensions.ContextAwareCqrsExtensions instead.");
|
||||||
AssertLegacyType(
|
AssertLegacyType(
|
||||||
typeof(ContextAwareMediatorCommandExtensions),
|
typeof(ContextAwareMediatorCommandExtensions),
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsCommandExtensions instead.");
|
"Use GFramework.Core.Extensions.ContextAwareCqrsCommandExtensions instead.");
|
||||||
AssertLegacyType(
|
AssertLegacyType(
|
||||||
typeof(ContextAwareMediatorQueryExtensions),
|
typeof(ContextAwareMediatorQueryExtensions),
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsQueryExtensions instead.");
|
"Use GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions instead.");
|
||||||
AssertLegacyType(
|
AssertLegacyType(
|
||||||
typeof(MediatorCoroutineExtensions),
|
typeof(MediatorCoroutineExtensions),
|
||||||
"Use GFramework.Core.Cqrs.Extensions.CqrsCoroutineExtensions instead.");
|
"Use GFramework.Core.Coroutine.Extensions.CqrsCoroutineExtensions instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace GFramework.Core.Coroutine.Extensions;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
[Obsolete(
|
[Obsolete(
|
||||||
"Use GFramework.Core.Cqrs.Extensions.CqrsCoroutineExtensions instead. This compatibility alias will be removed in a future major version.")]
|
"Use GFramework.Core.Coroutine.Extensions.CqrsCoroutineExtensions instead. This compatibility alias will be removed in a future major version.")]
|
||||||
public static class MediatorCoroutineExtensions
|
public static class MediatorCoroutineExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -17,14 +17,20 @@ internal sealed class CqrsDispatcher(
|
|||||||
IIocContainer container,
|
IIocContainer container,
|
||||||
ILogger logger) : ICqrsRuntime
|
ILogger logger) : ICqrsRuntime
|
||||||
{
|
{
|
||||||
|
// 进程级缓存:按请求/响应类型缓存直接处理器调用委托,避免热路径重复反射。
|
||||||
|
// 线程安全依赖 ConcurrentDictionary;缓存与进程同寿命,默认假设请求类型集合有限且稳定。
|
||||||
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), RequestInvoker>
|
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), RequestInvoker>
|
||||||
RequestInvokers = new();
|
RequestInvokers = new();
|
||||||
|
|
||||||
|
// 进程级缓存:缓存带 pipeline 的请求调用委托,减少每次分发时的反射与表达式重建开销。
|
||||||
|
// 若后续引入动态生成请求类型,需要重新评估该缓存的增长边界。
|
||||||
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), RequestPipelineInvoker>
|
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), RequestPipelineInvoker>
|
||||||
RequestPipelineInvokers = new();
|
RequestPipelineInvokers = new();
|
||||||
|
|
||||||
|
// 进程级缓存:缓存通知调用委托,复用并发安全字典以支撑多线程发布路径。
|
||||||
private static readonly ConcurrentDictionary<Type, NotificationInvoker> NotificationInvokers = new();
|
private static readonly ConcurrentDictionary<Type, NotificationInvoker> NotificationInvokers = new();
|
||||||
|
|
||||||
|
// 进程级缓存:缓存流式请求调用委托,避免每次创建流时重复解析反射签名。
|
||||||
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), StreamInvoker> StreamInvokers =
|
private static readonly ConcurrentDictionary<(Type RequestType, Type ResponseType), StreamInvoker> StreamInvokers =
|
||||||
new();
|
new();
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace GFramework.Core.Extensions;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
[Obsolete(
|
[Obsolete(
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsCommandExtensions instead. This compatibility alias will be removed in a future major version.")]
|
"Use GFramework.Core.Extensions.ContextAwareCqrsCommandExtensions instead. This compatibility alias will be removed in a future major version.")]
|
||||||
public static class ContextAwareMediatorCommandExtensions
|
public static class ContextAwareMediatorCommandExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace GFramework.Core.Extensions;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
[Obsolete(
|
[Obsolete(
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsExtensions instead. This compatibility alias will be removed in a future major version.")]
|
"Use GFramework.Core.Extensions.ContextAwareCqrsExtensions instead. This compatibility alias will be removed in a future major version.")]
|
||||||
public static class ContextAwareMediatorExtensions
|
public static class ContextAwareMediatorExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace GFramework.Core.Extensions;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
[Obsolete(
|
[Obsolete(
|
||||||
"Use GFramework.Core.Cqrs.Extensions.ContextAwareCqrsQueryExtensions instead. This compatibility alias will be removed in a future major version.")]
|
"Use GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions instead. This compatibility alias will be removed in a future major version.")]
|
||||||
public static class ContextAwareMediatorQueryExtensions
|
public static class ContextAwareMediatorQueryExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -11,10 +11,10 @@ public class AutoSceneGeneratorTests
|
|||||||
{
|
{
|
||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoSceneAttribute : Attribute
|
public sealed class AutoSceneAttribute : Attribute
|
||||||
@ -88,10 +88,10 @@ public class AutoSceneGeneratorTests
|
|||||||
{
|
{
|
||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoSceneAttribute : Attribute
|
public sealed class AutoSceneAttribute : Attribute
|
||||||
@ -137,10 +137,10 @@ public class AutoSceneGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoSceneAttribute : Attribute
|
public sealed class AutoSceneAttribute : Attribute
|
||||||
@ -225,10 +225,10 @@ public class AutoSceneGeneratorTests
|
|||||||
{
|
{
|
||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoSceneAttribute : Attribute
|
public sealed class AutoSceneAttribute : Attribute
|
||||||
@ -279,10 +279,10 @@ public class AutoSceneGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Game.Abstractions.Scene;
|
using GFramework.Game.Abstractions.Scene;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoSceneAttribute : Attribute
|
public sealed class AutoSceneAttribute : Attribute
|
||||||
|
|||||||
@ -11,10 +11,10 @@ public class AutoUiPageGeneratorTests
|
|||||||
{
|
{
|
||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoUiPageAttribute : Attribute
|
public sealed class AutoUiPageAttribute : Attribute
|
||||||
@ -100,10 +100,10 @@ public class AutoUiPageGeneratorTests
|
|||||||
{
|
{
|
||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoUiPageAttribute : Attribute
|
public sealed class AutoUiPageAttribute : Attribute
|
||||||
@ -183,10 +183,10 @@ public class AutoUiPageGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoUiPageAttribute : Attribute
|
public sealed class AutoUiPageAttribute : Attribute
|
||||||
|
|||||||
@ -13,9 +13,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -86,9 +86,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -141,9 +141,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -207,9 +207,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -284,9 +284,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -344,9 +344,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -414,9 +414,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -482,9 +482,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -549,9 +549,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -604,9 +604,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -659,9 +659,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
const string source = """
|
const string source = """
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
@ -715,9 +715,9 @@ public class AutoRegisterExportedCollectionsGeneratorTests
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
|
|
||||||
namespace GFramework.Godot.SourceGenerators.Abstractions
|
namespace GFramework.Godot.SourceGenerators.Abstractions.UI
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
|
||||||
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
public sealed class AutoRegisterExportedCollectionsAttribute : Attribute { }
|
||||||
|
|||||||
@ -18,7 +18,8 @@ namespace GFramework.Godot.SourceGenerators.Behavior;
|
|||||||
public sealed class AutoSceneGenerator : IIncrementalGenerator
|
public sealed class AutoSceneGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AutoSceneAttributeMetadataName =
|
private const string AutoSceneAttributeMetadataName =
|
||||||
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.AutoSceneAttribute";
|
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.UI.AutoSceneAttribute";
|
||||||
|
|
||||||
private static readonly string[] GeneratedMemberNames =
|
private static readonly string[] GeneratedMemberNames =
|
||||||
[
|
[
|
||||||
"SceneKeyStr",
|
"SceneKeyStr",
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace GFramework.Godot.SourceGenerators.Behavior;
|
|||||||
public sealed class AutoUiPageGenerator : IIncrementalGenerator
|
public sealed class AutoUiPageGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AutoUiPageAttributeMetadataName =
|
private const string AutoUiPageAttributeMetadataName =
|
||||||
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.AutoUiPageAttribute";
|
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.UI.AutoUiPageAttribute";
|
||||||
|
|
||||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,10 +18,10 @@ namespace GFramework.Godot.SourceGenerators.Registration;
|
|||||||
public sealed class AutoRegisterExportedCollectionsGenerator : IIncrementalGenerator
|
public sealed class AutoRegisterExportedCollectionsGenerator : IIncrementalGenerator
|
||||||
{
|
{
|
||||||
private const string AutoRegisterExportedCollectionsAttributeMetadataName =
|
private const string AutoRegisterExportedCollectionsAttributeMetadataName =
|
||||||
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.AutoRegisterExportedCollectionsAttribute";
|
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.UI.AutoRegisterExportedCollectionsAttribute";
|
||||||
|
|
||||||
private const string RegisterExportedCollectionAttributeMetadataName =
|
private const string RegisterExportedCollectionAttributeMetadataName =
|
||||||
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.RegisterExportedCollectionAttribute";
|
$"{PathContests.GodotSourceGeneratorsAbstractionsPath}.UI.RegisterExportedCollectionAttribute";
|
||||||
|
|
||||||
private const string GeneratedMethodName = "__RegisterExportedCollections_Generated";
|
private const string GeneratedMethodName = "__RegisterExportedCollections_Generated";
|
||||||
|
|
||||||
|
|||||||
@ -13,12 +13,13 @@
|
|||||||
`AutoRegisterExportedCollections` 会把这类样板收敛成声明式配置。
|
`AutoRegisterExportedCollections` 会把这类样板收敛成声明式配置。
|
||||||
|
|
||||||
它特别适合 `GameEntryPoint`、资源根节点、配置引导节点这类“导出即注册”的场景。
|
它特别适合 `GameEntryPoint`、资源根节点、配置引导节点这类“导出即注册”的场景。
|
||||||
|
相关特性当前位于 `GFramework.Godot.SourceGenerators.Abstractions.UI` 命名空间。
|
||||||
|
|
||||||
## 基础使用
|
## 基础使用
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
public interface IKeyValue<TKey, TValue>
|
public interface IKeyValue<TKey, TValue>
|
||||||
|
|||||||
@ -12,11 +12,12 @@
|
|||||||
- `GetScene()` 包装方法
|
- `GetScene()` 包装方法
|
||||||
|
|
||||||
`AutoScene` 会在编译期生成这些固定样板。
|
`AutoScene` 会在编译期生成这些固定样板。
|
||||||
|
该特性当前位于 `GFramework.Godot.SourceGenerators.Abstractions.UI` 命名空间。
|
||||||
|
|
||||||
## 基础使用
|
## 基础使用
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using GFramework.Game.Abstractions.Enums;
|
using GFramework.Game.Abstractions.Enums;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
|
|||||||
@ -13,11 +13,12 @@
|
|||||||
- `GetPage()` 工厂包装
|
- `GetPage()` 工厂包装
|
||||||
|
|
||||||
`AutoUiPage` 会把这部分样板迁移到编译期生成。
|
`AutoUiPage` 会把这部分样板迁移到编译期生成。
|
||||||
|
该特性当前位于 `GFramework.Godot.SourceGenerators.Abstractions.UI` 命名空间。
|
||||||
|
|
||||||
## 基础使用
|
## 基础使用
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using GFramework.Game.Abstractions.Enums;
|
using GFramework.Game.Abstractions.Enums;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ partial class MainMenu
|
|||||||
## 组合示例
|
## 组合示例
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using GFramework.Game.Abstractions.Enums;
|
using GFramework.Game.Abstractions.Enums;
|
||||||
using GFramework.SourceGenerators.Abstractions.Rule;
|
using GFramework.SourceGenerators.Abstractions.Rule;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|||||||
@ -610,7 +610,7 @@ AutoUiPage 生成器为 Godot 页面节点自动生成 `UiKeyStr`、缓存的 `I
|
|||||||
### 基础示例
|
### 基础示例
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using GFramework.Game.Abstractions.Enums;
|
using GFramework.Game.Abstractions.Enums;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@ -635,7 +635,7 @@ AutoScene 生成器为场景根节点自动生成 `SceneKeyStr`、缓存的 `ISc
|
|||||||
### 基础示例
|
### 基础示例
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using GFramework.Game.Abstractions.Enums;
|
using GFramework.Game.Abstractions.Enums;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ AutoRegisterExportedCollections 生成器为 Godot 导出集合自动生成批
|
|||||||
### 基础示例
|
### 基础示例
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
using GFramework.Godot.SourceGenerators.Abstractions;
|
using GFramework.Godot.SourceGenerators.Abstractions.UI;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
[AutoRegisterExportedCollections]
|
[AutoRegisterExportedCollections]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user