iNc0ming
iNc0ming

Reputation: 383

ef5 ObjectQuery "like"

I'm using EF5 for ObjectQuery,

var query = this.ObjectContext.CreateQuery<Role>("SELECT VALUE n FROM Role as n");
query = query.Where("it.Name like '%@name%'", new ObjectParameter("name", name));

But it doesn't work, which always return all results. Any ideas? Thx a lot!

Upvotes: 0

Views: 702

Answers (1)

Pawel
Pawel

Reputation: 31610

You want to use .Contains. When used on a string column translates to Sql LIKE

Upvotes: 2

Related Questions