I have this general function:
public List<T> GetList<T>() {
var businesType = typeof(T);
var databaseType = AutoMapperConfiguration.TypeMapping[businesType];
var databaseEntityList = DataModelAccess.GetEntityList(databaseType);
var businessEntityList = Mapper.Map(databaseEntityList, databaseEntityList.GetType(), typeof(List<T>));
return (List<T>)businessEntityList;
}
But what I want is to call DataModelAccess instead like this:
DataModelAccess.GetEntityList(databaseType);
- send a database type of type Generic, for example:
DataModelAccess.GetEntityList<DatabaseType>();
to return this method, for example List<T>.
Thanks! Postscript Definition DataModelAccess.GetEntityList (databaseType):
public static List<object> GetEntityList(Type databaseType)
{
}
source
share