Skip to content

Commit 3ea81b8

Browse files
committed
1 parent 1f035a7 commit 3ea81b8

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

Simple.Data/SimpleQuery.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,21 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, o
369369
}
370370
if (binder.Name.Equals("having", StringComparison.OrdinalIgnoreCase))
371371
{
372-
var expression = args.SingleOrDefault() as SimpleExpression;
373-
if (expression != null)
372+
SimpleExpression expression;
373+
try
374374
{
375-
result = new SimpleQuery(this, _clauses.Append(new HavingClause(expression)));
376-
return true;
375+
expression = args.SingleOrDefault() as SimpleExpression;
377376
}
378-
else
377+
catch (InvalidOperationException)
379378
{
380379
throw new ArgumentException("Having requires an expression");
381380
}
381+
if (expression != null)
382+
{
383+
result = new SimpleQuery(this, _clauses.Append(new HavingClause(expression)));
384+
return true;
385+
}
386+
throw new ArgumentException("Having requires an expression");
382387
}
383388
if (binder.Name.StartsWith("with", StringComparison.OrdinalIgnoreCase) && !binder.Name.Equals("WithTotalCount", StringComparison.OrdinalIgnoreCase))
384389
{

0 commit comments

Comments
 (0)