Skip to content

Feature Request: Customize Method Selection in MethodDecoratorMap Without Using Attributes #15

@mesutcakir

Description

@mesutcakir

Hello,

In our project, we want to use MethodDecoratorMap or a similar structure and choose the method here with a more dynamic approach instead of using attributes. Currently, we need to add an attribute like [Decorate(typeof(MyDecorator))] to each service method. However, instead of this alternative, methods are automatically selected and the decorator is displayed based on a certain standard of criteria (e.g. all methods marked as public and virtual).

Recommended Solution:
As a suggestion, I suggest adding a mechanism in MethodDecoratorMap or similar structure where method selection can be made via a user-supplied function or lambda description. This will allow us to automatically select methods and attributes according to a given set of rules, rather than manually changing attributes, especially in large projects.

An example usage scenario:

services.AddMethodDecoratorMap(config => {
      config.IncludeMethods(method => method.IsPublic && method.IsVirtual);
});

This feature provides great convenience in our project and other projects that work similarly. It will allow users to have a more flexible and dynamic pace, while also making the code easier to read and maintain.

Thank you for your support and contributions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions