Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ability to add an attribute to roots. #67

cNoNim started this conversation in Ideas
Discussion options

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.

You must be logged in to vote

Replies: 2 comments 1 reply

Comment options

@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.

You must be logged in to vote
1 reply
Comment options

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?

Comment options

I'll move this ticket to discussion for now for further consideration.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
enhancement New feature or request
Converted from issue

This discussion was converted from issue #65 on August 01, 2024 19:16.

AltStyle によって変換されたページ (->オリジナル) /