0

I have created one Parent library where in, I have a abstract class,and I have another child library where I have inherited the parent library, now I'm consuming this child library in web API controller, so, I would be consuming this in service layer,however, I'm not sure how to use it correctly, secondly I have all, the methods inside this library as protected, please guide how to do dependency injection for abstract class or do I need to create another interface or something for DI?

Code:

// Parent library
public abstract class Page
{
       protected abstract void ImplementAbstractMethod();
}

// Child library
public class ImplementPage : Page
{
    protected override void ImplementAbstractMethod()
     {
        // Implementation... 
     }
}


// Web API 
public class ServiceController 
{
    public ServiceController( ????) // How to do dependency injection, should I use abstract class, if yes then how to consume protected method, or, do I need to make it public?
    {
     }
}

// Or In business layer

public class Service
{
    public Service( ????) // How to do dependency injection, should I use abstract class, if yes then how to consume protected method, or, should I inherit the child library??
    {
     }
}
Mysterious288
  • 365
  • 5
  • 24

0 Answers0