I have a base class that implements an interface member as an abstract method. There are a few derived classes that override this abstract method. I have Ninject DI in place and Kernel will give an array of T(IEnumerable<T>)
. How can i call one specific derived class implementation using this IEnumerable<T>
.
Here is some sample code
This is my interface
public interface ICreateBatch
{
int CreateBatch();
}
This is my base class with Interface implementation
public abstract class CreateBatchBase:ICreateBatch
{
public abstract int CreateBatch();
}
Here is one of the derived class implementation
public class CreateDerived1Batch:CreateBatchBase
{
public override int CreateBatch()
{
//Derived one implementation
}
}
public class CreateDerived2Batch:CreateBatchBase
{
public override int CreateBatch()
{
//Derived two implementation
}
}
Ninject is giving me an IEnumerable. How can i specifically call CreateBatch() from CreateDerived1Batch?
Thanks in Advance.