I didn't know that you can do that with "LIKE". Apparently it's supported out of the box on LLBLGen. See this:
var orders = new EntityCollection<OrderEntity>();
var filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(OrderFields.OrderId % "1025%");
using (var adapter = new DataAccessAdapter())
{
adapter.FetchEntityCollection(orders, filter);
}
It actually compiles and generates this SQL:
SELECT [Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId],
...
FROM [Northwind].[dbo].[Orders]
WHERE ([Northwind].[dbo].[Orders].[OrderID] LIKE @p1)
@p1 is "1025%"
SQL Profiler reported this executed SQL:
exec sp_executesql N'SELECT [Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId],
...
FROM [Northwind].[dbo].[Orders]
WHERE ( [Northwind].[dbo].[Orders].[OrderID] LIKE @p1)',N'@p1 nvarchar(5)',@p1=N'1025%'
So, just use it like that. BTW, the warning posted by Al is also a good point you should consider.