How to avoid OrmLite OrderBy potential illegal fragments

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:

    .OrderBy(@"CASE WHEN myobject.bubble LIKE 'Prefix%' THEN 1 ELSE 2 END ASC, 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?

I’ve just added UnsafeOrderBy() that lets you do this which is available from v4.0.45 that’s now on MyGet.

In existing versions of OrmLite you can set the OrderByExpression directly, e.g:

var q = db.From<MyObject>();
q.OrderByExpression = @"ORDER BY CASE 
    WHEN myobject.bubble LIKE 'Prefix%' THEN 1 ELSE 2 END ASC, DESC";


That’s great. Thank you.