Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

Adds a Roslyn incremental source generator that produces lightweight POCO implementations of configuration interfaces at compile-time, eliminating runtime reflection for basic scenarios.

Implementation

  • Dapplo.Config.SourceGenerator: Detects IIniSection/IConfiguration<T> interfaces and generates classes with:

    • Property implementations with backing fields
    • INotifyPropertyChanged support
    • Static Create() factory methods
  • Test project: Validates code generation and provides usage examples

Usage

[IniSection("MyConfig")]
public interface IMyConfig : IIniSection
{
    string Name { get; set; }
    int Port { get; set; }
}

// Generated class available at compile-time
var config = MyConfigGenerated.Create();
config.Name = "Service";

Scope & Limitations

Generated implementations provide property storage and change notification only. Does not include:

  • INI file persistence
  • Interceptors (transactions, write protection, change tracking)
  • Attribute processing (DefaultValue, etc.)

Use the existing reflection-based API (IniSection<T>.Create()) for full feature set. This provides a foundation for future metadata pre-computation that will eliminate reflection while preserving all functionality.

Quality

  • CodeQL: 0 alerts
  • Compatible with AOT compilation scenarios
Original prompt

This section details on the original issue you should resolve

<issue_title>Add source generator support to get rid of the reflection</issue_title>
<issue_description>Change the project to use source generations, so that the user of this library no longer needs to use reflection.
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 7, 2026
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 5 commits January 7, 2026 22:01
Co-authored-by: Lakritzator <708125+Lakritzator@users.noreply.github.com>
Co-authored-by: Lakritzator <708125+Lakritzator@users.noreply.github.com>
Co-authored-by: Lakritzator <708125+Lakritzator@users.noreply.github.com>
Co-authored-by: Lakritzator <708125+Lakritzator@users.noreply.github.com>
Co-authored-by: Lakritzator <708125+Lakritzator@users.noreply.github.com>
Copilot AI changed the title [WIP] Add source generator support to eliminate reflection Add source generator for reflection-free configuration POCOs Jan 7, 2026
Copilot AI requested a review from Lakritzator January 7, 2026 22:15
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.

Add source generator support to get rid of the reflection

3 participants