I'm writing some code that should update some fields with a common logic on different remote objects. Therefore I use given API. The Test Class is my own implementation. The other two classes are given by the API. When I write the following code i get the error
The type 'T' must be a reference type in order to use it as parameter 'T' in the generic type or method 'QueryAPI.Query<T>()
Code:
public class Test<T> where T : class, UnicontaBaseEntity
{
private async Task Foo<T>(QueryAPI queryAPI, CrudAPI crudAPI, SyncSettings syncSettings)
{
Task<T[]> result = await queryAPI.Query<T>();
}
}
public interface UnicontaBaseEntity : UnicontaStreamableEntity
{
int CompanyId { get; }
Type BaseEntityType();
}
public class QueryAPI : BaseAPI
{
...
public Task<T[]> Query<T>() where T : class, UnicontaBaseEntity, new();
...
}
Any ideas on this?
Thanks in advance.
KR Mike