I was wondering if this code could be improved. The IProvider implements IProvider and overwrites Request(...). I'd like to combine these into a single interface. But I still need a typed and untyped interface to work with.
Is there a way to combine these where I get both or is this how the interfaces should look?
public interface IProvider
{
DataSourceDescriptor DataSource { get; set; }
IConfiguration Configuration { get; set; }
IResult Request(IQuery request);
}
public interface IProvider<T> : IProvider
{
new IResult<T> Request(IQuery request);
}
If the generic type parameter T
is only relevant in the context of the Request
method, declare only that method as generic:
public interface IProvider
{
DataSourceDescriptor DataSource { get; set; }
IConfiguration Configuration { get; set; }
IResult Request(IQuery request);
IResult<T> Request<T>(IQuery request);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With