I have a base class with the following signature
public class ReportViewModelBaseDTO<VT,DT>
and concrete classes like these
public class ChartViewModelDTO:ReportViewModelBaseDTO<ChartViewModel,ChartViewModelDTO>
My question is, I know that the second type parameter of my generic base class should be the type of the concrete class. I don't want to repeat myself all the time by naming the class and then repeating that name as the type parameter.
Is there any way to have my generic base class take the actual concrete class as a type paramaeter? does anyone have any suggestions on better ways to do this?
EDIT:
an example of how I want to use DT is below. I create an instance of type DT from one of type VT thru Automapper.
public static DT Create(VT viewModel)
{
return Mapper.Map<VT,DT>(viewModel);
}