dev31
dev31

Reputation: 11

Dapper Extension LIKE operator returning results in reverse order while matching string

I am using Dapper Extension method GetByPredicate and passing the predicate value with Like operator.

Predicates.Field<Entity>(row => row, Operator.Like, $"%{string}%")

But while matching the string pattern it is returning results in reverse order, eg: if the sql table contains rows having 'test1' and 'test2' string then for a given string 'test', it is returning results as test2 and test1.

Wondering why it is returning in reversed order.

Upvotes: 0

Views: 350

Answers (1)

Alexander
Alexander

Reputation: 9632

Relational databases usually do not guarantee order in which rows are returned. If you want you rows returned in specific order use order by clause for this purpose.

Upvotes: 1

Related Questions