I am trying to implement an abstract class using C#, that also combined Dependency Injection in the constructor. The approach I am currently taking seems rather cumbersome, and possibly wrong (!) so your help is greatly appreciated. This is the approach I have took:
public abstract class MyAbstractClass
{
    protected IValue Value { get; set; }
    public MyAbstractClass (IValue value) 
    {
        this.Value = value;
    }
    public abstract void Configuration();
    public void Confirmation()
    {
        // Do something
    }
}
public class MyMainClass : MyAbstractClass
{
    public MyMainClass (IValue value) : base (value)
    {
    }
    public override void Configuration()
    {
        // Configure
    }
}
// Calling MyMainClass from any method, which also has access to DI fields
public class AnotherClass()
{
    public IValue Value { get; set; }
    public AnotherClass(IValue value)
    {
        this.Value = value;
    }
    
    public void Worker()
    {
        var mainClass = new MyMainClass(Value);
    }
}
Now the problem lies in the Worker() with the class to MyMainClass(), since it seems like I am passing in a parameter, rather than utilising DI...
Thanks!
 
     
    