Skip to content

Extract DiRegistrationMap for explicit container registrations (#233)#239

Merged
Skymly merged 1 commit into
mainfrom
feature/di-registration-map-explicit
Jul 22, 2026
Merged

Extract DiRegistrationMap for explicit container registrations (#233)#239
Skymly merged 1 commit into
mainfrom
feature/di-registration-map-explicit

Conversation

@Skymly

@Skymly Skymly commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Introduce DiRegistrationMap / DiRegistrationMapBuilder that records type→lifetime from explicit MSDI (Add* / TryAdd) and Autofac (RegisterType / Register) registrations.
  • Wire CaptiveDependencyAnalyzer DP062 constructor analysis for those entries to read the map; keep attributed RegisterDi and DP066 factory-delegate collection private (out of scope for Registration map: explicit container registrations #233).
  • Add unit tests for representative map shapes; existing DP062/DP066 Verify coverage stays green (behaviour freeze).

Related Issue

Closes #233

Solution module

  • Analyzers (DesignPatterns.Analyzers/ + DesignPatterns.CodeFixes/)

Type of change

  • Refactor (no behavior change)

Test plan

  • dotnet test tests/DesignPatterns.Analyzers.Tests --filter FullyQualifiedName~DiRegistrationMapTests
  • dotnet test tests/DesignPatterns.Analyzers.Tests --filter "FullyQualifiedName~CaptiveDependency|FullyQualifiedName~FactoryDelegateCaptive"
  • ./build.ps1 --target Ci --configuration Release
  • Sibling samples (if API/generator behavior changed): N/A (internal analyzer refactor)

Breaking changes

  • None

Checklist

  • This PR touches only one solution module (see AGENTS.md)
  • Commit messages are in English (no AI/agent tooling mentions in commits)
  • PR description is English only
  • No version bumps, tags, releases, or NuGet publish steps included unless explicitly requested
  • Public API / diagnostic / generated code changes are documented if user-visible

Documentation checklist

  • No documentation changes needed

Move MSDI Add*/TryAdd and Autofac RegisterType/Register collection into a shared map so Captive Dependency DP062 constructor analysis reads type→lifetime from Build instead of private analyzer lists.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Skymly
Skymly merged commit dbe8c83 into main Jul 22, 2026
7 of 8 checks passed
@Skymly
Skymly deleted the feature/di-registration-map-explicit branch July 22, 2026 13: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.

Registration map: explicit container registrations

1 participant