Background
During working with legacy code, I have found that many people used DataTable/DataSet instead of strongly typed objects. They are using some code likestring id = row["id"].ToString();instead of
string id = request.Id;
It is becoming a maintenance hell because of several reasons:
- I do not know the data type from database, so I need to debug into database procedure
- I do not know whether the data is nullable or not, again I need to debug into database
- When I need to change the data type, I need to search for every implementation, change it and make sure it does not break
- Keep the same programming style, using the DataTable, with the risk that you add another more maintenance hell object
- Refactor it, with the risk of breaking is higher