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

Make the _options field protected instead of private #108

Closed
gsandorx opened this issue Jan 16, 2021 · 1 comment
Closed

Make the _options field protected instead of private #108

gsandorx opened this issue Jan 16, 2021 · 1 comment

Comments

@gsandorx
Copy link

I had to extend the SieveProcessor class via inheritance. I overwrote the MapProperties method in my class and needed to read the configuration (through Options). However, this is not accessible.

public class MySieveProcessor 
{
       public IOptions<SieveOptions> Options { get; private set; }
 
       public MySieveProcessor(
            IOptions<SieveOptions> options)
            : base(options)
        {
            Options = options;
        }

       protected override SievePropertyMapper MapProperties(SievePropertyMapper mapper)
       {
               // I need to read the configuration here. However, this method gets called by the base class, meaning that I can't even 
               // use my own Options property because it hasn't reached that line in my constructor yet. And the base SieveProcessor
               // _options member is private
       }
}
@hasanmanzak
Copy link
Collaborator

I don't see any downsides to make Options property protected. I'll change the MapProperties method call place, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants