Skip to content
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

Add option to Attribute Injection for required services #23

Open
enisn opened this issue Dec 13, 2021 · 0 comments
Open

Add option to Attribute Injection for required services #23

enisn opened this issue Dec 13, 2021 · 0 comments
Assignees
Labels
feature New feature or request good first issue Good for newcomers
Milestone

Comments

@enisn
Copy link
Owner

enisn commented Dec 13, 2021

[InjectService] attribute should have IsRequired parameter to decide that dependency resolution is optional or not.

Sample usage should be like below.

public class MyService
{
    // Following definition will throw an exception if that service wasn't registered to service collection.
    [InjectService(IsRequired = true)]
    public IMustExistService { get; private set; }

    // Following property might be null if that service wasn't registered to service collection.
    [InjectService(IsRequired = false)]
    public IOptionalService { get; private set; }
}
@enisn enisn added the feature New feature or request label Dec 13, 2021
@enisn enisn added this to the v2.6 milestone Dec 13, 2021
@enisn enisn self-assigned this Dec 13, 2021
@enisn enisn added the good first issue Good for newcomers label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant