Skip to content

Source Generator should scan for RegisterProvider attributes at build time #9730

@ReubenBond

Description

@ReubenBond

To support configuring providers directly from IConfiguration (eg, emitted by Aspire), we scan for [RegisterProvider(...)] attributes in all assemblies. This should be done via code generation instead. i.e, we should create a list of the known providers in generated metadata instead of needing to perform assembly scanning and reflection.

Here are some relevant code references:

Scanning on the client:

foreach (var attr in asm.GetCustomAttributes<RegisterProviderAttribute>())

Scanning on the silo:

foreach (var attr in asm.GetCustomAttributes<RegisterProviderAttribute>())

The RegisterProviderAttribute definition:

public sealed class RegisterProviderAttribute(

TypeManifestOptions:

public sealed class TypeManifestOptions

MetadataGenerator:
https://github.com/dotnet/orleans/blob/f23233a70dd3c4d5f216c7be2aa2ed8faca7a58a/src/Orleans.CodeGenerator/MetadataGenerator.cs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions