You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #dde0ade, we replaced `reader.GetValue()` with strongly typed extension methods, such as `reader.GetInteger()`. Under the hood, these simply looked up the ordinal value of the column name, and then called the underlying `SqlDataReader` methods such as `GetInt32()`, `GetBoolean()`, &c. Unfortunately, that approach doesn't work because the values being returned aren't actually e.g. `INT`, `BIT`, &c. Instead, they're (almost always) strings, especially when they map to `AttributeKey` or `AttributeValue` (as is true of attributes, including `Key`, `ParentId`, `ContentType`, `IsHidden`, &c.). As such, instead of calling the underlying strongly typed methods, we need to call `SqlDataReader.GetValue()` and then do a conversion. To support this, the private `GetValue()` extension is now setup to instead accept a `TryParse` delegate so that e.g. `Boolean.TryParse` can be passed as the delegate. This isn't all that elegant, but it should work, and it still results in much cleaner code in `SqlTopicRepository`, which was the original objective.
0 commit comments