My goal is to select rows from a table ordered by date, but with some rows that have a value in one of the columns beginning with a certain string bubbled to the top. This is how I attempted to do it:
db.LoadSelect(db.From<MyObject>()
.OrderBy(@"CASE WHEN myobject.bubble LIKE 'Prefix%' THEN 1 ELSE 2 END ASC, myobject.date DESC"),
new[] {"Reference1", "Reference2"});
This throws an ArgumentException
stating “Potential illegal fragment detected.” After looking at the OrmLite code I suspect it is because of the %
character. Is there a better way to achieve what I’m trying to do, or is there a way to suppress the illegal fragment check on a query-by-query basis?