Change behaviour of Contains method

May 3, 2010 at 4:17 PM

If I use Contains method on string for example

var list = db.Customers.Where(c => c.CustomerID.Contains("A"))

it produces parametrized SQL statement with where clause:

where (c.CustomerID like '%' + @p0 +'%') 

with @p0 parameter value of "A".

It would be much better if we can produce statement like

where (c.CustomerID like @p0)

with @p0 parameter value of '%A%'.

I've starded changing behaviour of Parametrizer class, but I'm not sure if this is best location to do this.

Any advice?


<font size="2" color="#0000ff">