Named Type Constructor (Entity SQL)

 

Used to create instances of conceptual model nominal types such as Entity or Complex types.

  
[{identifier. }] identifier( [expression [{, expression }]] )  

identifier
Value that is a simple or quoted identifier. For more information see, Identifiers

expression
Attributes of the type that are assumed to be in the same order as they appear in the declaration of the type.

Instances of named complex types and entity types.

The following examples show how to construct nominal and complex types:

The expression below creates an instance of a Person type:

Person("abc", 12)

The expression below creates an instance of a complex type:

MyModel.ZipCode(‘98118’, ‘4567’)

The expression below creates an instance of a nested complex type:

MyModel.AddressInfo('My street address', 'Seattle', 'WA', MyModel.ZipCode('98118', '4567'))

The expression below creates an instance of an entity with a nested complex type:

MyModel.Person("Bill", MyModel.AddressInfo('My street address', 'Seattle', 'WA', MyModel.ZipCode('98118', '4567')))

The following example shows how to initialize a property of a complex type to null:MyModel.ZipCode(‘98118’, null)

The following Entity SQL query uses the named type constructor to create an instance of a conceptual model type. 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.

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

[!CODE [DP EntityServices Concepts 2#NAMED_TYPE_CONSTRUCTOR](../CodeSnippet/VS_Snippets_Data/dp entityservices concepts 2#named_type_constructor)]

Constructing Types
Entity SQL Reference

Show: