Problem here is you're expecting contravariance covariance for concrete type generic parameters.
Basically, you won't never achieve your goal using a concrete type, but there's a workaround for this.
You can design a marker interface like this:
public interface IBaseStepHandler<out T> // "out" marks T as covariant
where T : BaseDataModel // Do you have a model base type? ;)
{
// Declare members here
}
Where I say "declare members here", just declare such members which are part of your concrete base class (I'm talking about "BaseStepHandler").
After that, implement this interface in your base class BaseStepHandler.
Now, you can do what you want:
IBaseStepHandler<BaseDataModel> some = new WhateverBaseStepHandlerClass();
// This is possible because T generic parameter is covariant and it can be casted to `BaseDataModel`, or if you don't provide a `T` generic parameter constraint, you could cast it to `IBaseStepHandler<object>` too!
In order to learn more about covariance, follow this link: http://msdn.microsoft.com/en-us/library/ee207183.aspx
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…