Skip to content

Commit

Permalink
Simplify conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Jun 3, 2021
1 parent c55106f commit 139f72f
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,15 @@ public SqliteDateOnlyMemberTranslator(ISqlExpressionFactory sqlExpressionFactory
Check.NotNull(returnType, nameof(returnType));
Check.NotNull(logger, nameof(logger));

if (member.DeclaringType != typeof(DateOnly))
{
return null;
}

if (_datePartMapping.TryGetValue(member.Name, out var datePart))
{
return _sqlExpressionFactory.Convert(
return member.DeclaringType == typeof(DateOnly) && _datePartMapping.TryGetValue(member.Name, out var datePart)
? _sqlExpressionFactory.Convert(
SqliteExpression.Strftime(
_sqlExpressionFactory,
typeof(string),
datePart,
instance!),
returnType);
}

return null;
returnType)
: null;
}
}
}
Expand Down

0 comments on commit 139f72f

Please sign in to comment.