Generic Class Loader: 'T' must be a non-abstract type with a public parameterless constructor
Solution 1:
The T : new()
constraint is missing in the calling method’s own generic type.
public async Task<IEnumerable<T>> GetObjectAsync<T>(string procedureName)
Thus the compiler cannot guarantee the constraint requirement for the interface in IMyEntity<T>
is met. It is not related to any specific method call and the restriction requirement comes from the interface definition itself.
public interface IMyEntity<T> where T : new()
Either remove the restriction from the interface — in which case new T()
cannot be used — or add the restriction to the calling method’s generic type.