I would like to have one interface for all network related tasks. Tasks implement this interface:
public interface IDataForGrid<T> { IGridResponse<T> GetList(IGridRequest request); }
Type T is always a DTO class. I cannot create a common interface for these DTOs because they have nothing in common. Just a dumb DTO with certain properties.
I would like to use it as follows:
public class Service1 { public IGridResponse CreateResponse(IGridRequest request) { ... IDataForGrid<T> aa; if(request == 1) aa = new CustomerGridData; if(request == 2) aa = new OrderGridData; var coll = aa.GetList(); } } public class CustomerGridData : IDataForGrid<CustomerDTO> { ... }
The problem is that I do not know what to put in place of T.
user137348
source share