I'm trying to model bind using a model bind provider.
When the GetBinder
method is hit I want to serve up a model binder based on what is passed in.
I have a generic model IBaseModel<T> where T : IEntity
.
I can grab the BaseModel
from the type but what i really want is the <T>
on the BaseModel<T>
which is an IEntity
.
public IModelBinder GetBinder(Type modelType)
{
Type baseModel = modelType.GetInterface(typeof(IBaseModel<>).Name);
if (baseModel != null)
{
if (baseModel.IsGenericType)
{
//want to get <T> (IEntity) here.
}
}
Thanks in advance