Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

GetCount() behaves unexpectedly #227

Closed
hmobius opened this Issue · 1 comment

2 participants

@hmobius

Run GetCount() through a few basic scenarios and it produced a number of unexpected results.

  1. Passed.just the column name for the parameter.
    db.Albums.GetCount(db.Albums.GenreId);
    Expected SD to return null or throw a BadExpressionException. It actually runs
    select count(*) from albums

  2. Passed just a value for the parameter.
    db.Albums.GetCount(1);
    Expected SD to return null or throw a BadExpressionException. It actually runs
    select count(*) from albums

  3. Passed an invalid SimpleExpression using = instead of ==.
    db.Albums.GetCount(db.Albums.GenreId = null);
    Expected SD to throw a BadExpressionException. It actually throws a Microsoft.CSharp.RuntimeBinderException

  4. Passed an invalid SimpleExpression. GenreId is int32, not a string
    db.Albums.GetCount(db.Albums.GenreId == "a");
    Expected SD to throw a BadExpressionException. It actually throws a System.FormatException.

  5. Passed two valid SimpleExpressions when it should be passed a max of one.
    db.Albums.GetCount(db.Albums.GenreId == 1, db.Albums.ArtistId == 120);
    Expected SD to throw a System.ArgumentException. It actually runs
    select count(*) from albums

@markrendle markrendle referenced this issue from a commit
@markrendle Fixes for issue #227 44a3589
@markrendle
Owner

All fixed except 4; I can't intercept type issues before the Adapter because I can't make assumptions about the underlying system.

@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.