4 ms·
Why not just use an interface for this?
by flippinburgers 5y ago
Why not just use an interface for this?
- cpuguy83 5y agoDo you have an example of how to make this work with an interface?
- flippinburgers 5y agoThe author conveniently leaves out the implementation of the actual method calls themselves, which is frankly the important part. interface Query { All ... Insert ... Update ... Delete ... WhateverElse ... } Now admittedly, the implementation is probably cleaner with "generics", but you can generically approach the problem with interfaces.
- cpuguy83 5y agoBut how do you get the thing that implements that interface? Either the framework has to know how to create a querier for each specific type, drop to using empty interfaces, or use generics.
- flippinburgers 5y agoThe point of the interface is that the person authoring the code defines the internals.