WAQS Querying: Contains method support

7 reasons to use WAQS

WAQS documentation

 

LINQ To Entities supports Contains method but only on scalar types.

LINQ To WAQS also supports it for entity types.

So, if you use a contains on an entity type collection, LINQ To WAQS uses the entity key to transform our entity collection to a scalar type collection if the entity key just contains one property. Otherwise, it uses an aggregation of AND and OR.

So, for example, you can use this query:

await _context.Products.AsAsyncQueryable().Where(p => SelectedSuppliers.Contains(p.Supplier)).ExecuteAsync()
This entry was posted in 12253, 16868, 7674. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>