-
Notifications
You must be signed in to change notification settings - Fork 2
Source Generator Improvement Proposal #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,21 +8,21 @@ public class ServiceRegistrationAttribute : Attribute | |
| public Lifetime ServiceRegistrationType { get; set; } | ||
|
|
||
| public bool RegisterInterfaces { get; set; } | ||
|
|
||
| public Type? ServiceType { get; set; } | ||
|
|
||
| public string? Key { get; set; } | ||
|
|
||
| public ServiceRegistrationAttribute() | ||
| { | ||
| ServiceRegistrationType = Lifetime.Transient; | ||
| } | ||
|
|
||
| public ServiceRegistrationAttribute(Lifetime serviceRegistrationType) | ||
| { | ||
| ServiceRegistrationType = serviceRegistrationType; | ||
| } | ||
|
|
||
| public ServiceRegistrationAttribute(Lifetime serviceRegistrationType = Lifetime.Transient, bool registerInterfaces = false) | ||
| public ServiceRegistrationAttribute( | ||
| Lifetime serviceRegistrationType = Lifetime.Transient, | ||
| bool registerInterfaces = false, | ||
| Type? serviceType = null, | ||
| string? key = null) | ||
| { | ||
| ServiceRegistrationType = serviceRegistrationType; | ||
| RegisterInterfaces = registerInterfaces; | ||
| ServiceType = serviceType; | ||
| Key = key; | ||
|
Comment on lines
10
to
+25
|
||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description shows applying multiple [ServiceRegistration] attributes to the same class (multiple keys), but this attribute does not set AllowMultiple=true, so consumers will get a compile-time error when stacking the attribute. Update the AttributeUsage to allow multiple (and ensure the runtime copy of this attribute in Stellar/ServiceRegistrationAttribute.cs is updated the same way).