Skip to content

Loading…

ToScalar needs consistent behaviour over SimpleRecord and SimpleQuery #230

Closed
hmobius opened this Issue · 2 comments

2 participants

@hmobius

Call SimpleQuery.ToScalar(). It throws an exception unless SimpleQuery contains one item with only one property in it.

Call SimpleRecord.ToScalar(). It just returns the scalar value for the first property.

Suggest : SimpleRecord.ToScalar() throws SimpleDataException if there are multiple properties in SimpleRecord like SQ.ToScalar().

@markrendle
Owner
@markrendle
Owner

I went the other way, and made SimpleQuery more forgiving. Introducing a new exception could break existing code. Also, the prescribed behaviour of IDbDataReader.ExecuteScalar is to return the first value of the first row and ignore everything else, which would seem a good design cue.

@markrendle markrendle closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.