GetCount() behaves unexpectedly #227

Closed
hmobius opened this Issue Sep 28, 2012 · 1 comment

Comments

Projects
None yet
2 participants

hmobius commented Sep 28, 2012

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 added a commit that referenced this issue Oct 15, 2012

@markrendle markrendle Fixes for issue #227 44a3589
Owner

markrendle commented Oct 15, 2012

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

markrendle closed this Oct 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment