MULTISET (Entity SQL)

Creates an instance of a multiset from a list of values. All the values in the MULTISET constructor must be of a compatible type T. Empty multiset constructors are not allowed.


MULTISET ( expression [{, expression }] )
or
{ expression [{, expression }] }

expression

Any valid list of values.

A collection of type MULTISET<T>.

Entity SQL provides three kinds of constructors: row constructors, object constructors, and multiset (or collection) constructors. For more information, see Constructing Types (Entity SQL).

The multiset constructor creates an instance of a multiset from a list of values. All the values in the constructor must be of a compatible type.

For example, the following expression creates a multiset of integers.

MULTISET(1, 2, 3)

{1, 2, 3}

NoteNote

Nested multiset literals are only supported when a wrapping mutiset has a single multiset element; for example, {{1, 2, 3}}. When the wrapping multiset has multiple multiset elements (for example, {{1, 2}, {3, 4}}), nested multiset literals are not supported.

The following Entity SQL query uses the MULTISET operator to create an instance of a multiset from a list of values. The query is based on the AdventureWorks Sales Model. To compile and run this query, follow these steps:

  1. Follow the procedure in How to: Execute a Query that Returns StructuralType Results (EntityClient).

  2. Pass the following query as an argument to the ExecuteStructuralTypeQuery method:

SELECT VALUE product FROM AdventureWorksEntities.Product 
    AS product WHERE product.ListPrice IN MultiSet (125, 300)

This example produces the following output:

ProductID: 842
Name: Touring-Panniers, Large
ProductNumber: PA-T100
MakeFlag: False
...
Show: