This is why we have switch statements
I came across a head-slappingly dumb bug earlier with a generic method. Which only occurred for Task types A or B. If you spot it, give yourself a "my isn't that obvious" cookie.
public List
Yes I know this is not the ideal way to handle generics but as some point, different stored procedures must be called for different classes and I think it's better to make that distinction in the service rather than the repository layer. You're repositories should just be calling stored procs and handling the returning values.
Of course you can't use a switch statement here because switch statements require constant values... So the only fix here was to add in that missing else
and update the unit tests to cover the method correctly.
- Previous: So you want to outsource?
- Next: Frozen Branch