Context
Follow-up to #16. Once the EF Core bits live in a separate Kalicz.StrongTypes.EFCore package, the only friction left for users is knowing the package exists.
VS/Rider's built-in "unresolved symbol → install NuGet package" code fix already handles the case where a user types UseStrongTypes() without a reference — so nothing special is needed there.
What the IDE can't do on its own is proactively tell a user "you've declared a NonEmptyString column on an EF Core entity but you haven't installed the converter package." For that we'd ship a Roslyn analyzer inside the core Kalicz.StrongTypes package.
Proposal
Add a src/StrongTypes.Analyzers/ project (netstandard2.0, references Microsoft.CodeAnalysis.CSharp.Workspaces) packed into Kalicz.StrongTypes under analyzers/dotnet/cs/.
The analyzer emits a diagnostic when it sees a strong type used as an EF Core mapped property (e.g. on a class whose DbSet lives in a DbContext) without the StrongTypes.EFCore assembly referenced. The accompanying code fix adds the package reference.
Precedent: Microsoft.Extensions.Logging.Abstractions, System.Text.Json source-generator diagnostics, Microsoft.AspNetCore.Mvc.Api.Analyzers.
Why not now
The analyzer only becomes useful after #16 — there's no package to suggest installing today. And analyzer development has its own footprint (release versioning, suppression story, false-positive management) that deserves its own decision.
Done when
Depends on #16.
Context
Follow-up to #16. Once the EF Core bits live in a separate
Kalicz.StrongTypes.EFCorepackage, the only friction left for users is knowing the package exists.VS/Rider's built-in "unresolved symbol → install NuGet package" code fix already handles the case where a user types
UseStrongTypes()without a reference — so nothing special is needed there.What the IDE can't do on its own is proactively tell a user "you've declared a
NonEmptyStringcolumn on an EF Core entity but you haven't installed the converter package." For that we'd ship a Roslyn analyzer inside the coreKalicz.StrongTypespackage.Proposal
Add a
src/StrongTypes.Analyzers/project (netstandard2.0, referencesMicrosoft.CodeAnalysis.CSharp.Workspaces) packed intoKalicz.StrongTypesunderanalyzers/dotnet/cs/.The analyzer emits a diagnostic when it sees a strong type used as an EF Core mapped property (e.g. on a class whose DbSet lives in a
DbContext) without theStrongTypes.EFCoreassembly referenced. The accompanying code fix adds the package reference.Precedent:
Microsoft.Extensions.Logging.Abstractions,System.Text.Jsonsource-generator diagnostics,Microsoft.AspNetCore.Mvc.Api.Analyzers.Why not now
The analyzer only becomes useful after #16 — there's no package to suggest installing today. And analyzer development has its own footprint (release versioning, suppression story, false-positive management) that deserves its own decision.
Done when
StrongTypes.Analyzersproject ships insideKalicz.StrongTypesas an analyzer.NonEmptyString(and future strong-type) EF Core mapped properties whenStrongTypes.EFCoreisn't referenced.Depends on #16.