henkmollema / Dommel

CRUD operations with Dapper made simple.
MIT License
634 stars 100 forks source link

Problems using like-queries #216

Closed giancarlomelis closed 4 years ago

giancarlomelis commented 4 years ago

Hi. I'm trying to use Like-queries as shown in documetation:

using (var con = new SqlConnection())
{
   var products = con.Select<Product>(p => p.Name == "Awesome bike");

   var products = con.Select<Product>(p => p.Created < new DateTime(2014, 12, 31) && p.InStock > 5);
}

but when i try to execute this script:

            using (DbContext ctx = new DbContext())
            {
                IEnumerable<User> users = ctx.Connection.Select<User>(u => u.UserName.StartsWith("op", StringComparison.InvariantCultureIgnoreCase));
                usersBindingSource.DataSource = users.ToList();
            }

I'm getting this exeption:

An expression of non-boolean type specified in a context where condition is expected, near '('

I'm using Dommel.1.11.0

Thanks.

henkmollema commented 4 years ago

StartsWith with only works in Dommel 2.0. Also don't pass the StringComparison options.