Skip to content

Conversation

Copy link

Copilot AI commented Dec 11, 2025

The README lacked concrete examples of what the source generator produces and how it rewires DI registrations to inject resilience pipelines.

  • Generator flow overview: Added a concise walkthrough of how [ResiliencePipeline] methods are detected, validated, and mapped to generated wrappers (interface vs concrete cases).
  • Generated class shape: Included a representative snippet showing the emitted wrapper that resolves the pipeline and delegates to the original implementation.
  • DI override mechanics: Documented how the generator rewrites AddTransient/Scoped/Singleton registrations to use the generated wrapper while preserving original factories via interceptors.

Example wrapper:

[GeneratedCode("Kinetic2", "1.0.0")]
internal sealed class NotificationService__INotificationService__K2p : INotificationService
{
    private readonly IServiceProvider _serviceProvider;
    private readonly INotificationService _instance;

    internal NotificationService__INotificationService__K2p(IServiceProvider sp, NotificationService instance)
    {
        _serviceProvider = sp;
        _instance = (INotificationService)instance;
    }

    public ValueTask NotifyAsync(string to, string subject, string body) =>
        ResilienceExtensions.ExecuteResiliencePipeline<NotificationService__INotificationService__K2p>(
            _serviceProvider, "NotifyAsyncFromInterface",
            _ => _instance.NotifyAsync(to, subject, body),
            CancellationToken.None);
}
Original prompt

The readme in this repo has way too little ... examples. and it doesnt make it obvious what is being done here. Add sections of the source generated code and especially elaborate on the a) code generation logic and b) the injection and override mechanism of injection a generated class into the existing and unchanged DI registration. show the structure of the generated class


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add detailed examples and code structure to README Improve README with concrete generator examples and DI override explanation Dec 11, 2025
Copilot AI requested a review from dlosch December 11, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants