-
Notifications
You must be signed in to change notification settings - Fork 29
-
In #63 assumes that if a composition has the [Module] attribute, then the [Provides] attribute is generated for its roots.
But controlling which attributes are added to roots would be ideal, similar to controlling modifiers via RootKinds.
I'm not sure which API is exactly realizable in terms of source generator capabilities.
Maybe something like:
DI.Setup() .Root<IService>( "Service", attributes: [ new ProvidesAttribute(), new MethodImplAttribute(MethodImplOptions.AggressiveInlining) ]);
Note: Another RootKinds.Provides for the Module API may be a better choice.
This API will be used a lot.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 1 reply
-
@cNoNim It is now possible to create partial methods. See this example. They allow you to define attributes for the roots of a composition. I don't see the point of overloading methods to define roots with an additional argument - a list of attributes.
Beta Was this translation helpful? Give feedback.
All reactions
-
That's a good point. No further questions.
Maybe the partial method is better than the RootKinds. Can the generator not add modifiers and add partial automatically to the generated root, if there is a partial method?
Beta Was this translation helpful? Give feedback.
All reactions
-
I'll move this ticket to discussion for now for further consideration.
Beta Was this translation helpful? Give feedback.