Partilhar via


EntitySet Element (SSDL)

An EntitySet element in store schema definition language (SSDL) represents a table or view in the underlying database. An EntityType element in SSDL represents a row in the table or view. The EntityType attribute of an EntitySet element specifies the particular SSDL entity type that represents rows in an SSDL entity set. The mapping between a CSDL entity set and an SSDL entity set is specified in an EntitySetMapping element.

The EntitySet element can have the following child elements (in the order listed):

Applicable Attributes

The following table describes the attributes that can be applied to the EntitySet element.

Note

Some attributes (not listed here) may be qualified with the store alias, which is the alias for the https://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator namespace. These attributes are used by the Update Model Wizard when updating a model.

Attribute Name Is Required Value

Name

Yes

The name of the entity set.

EntityType

Yes

The fully-qualified name of the entity type for which the entity set contains instances.

Schema

No

The database schema.

Table

No

The database table.

Note

Any number of annotation attributes (custom XML attributes) may be applied to the EntitySet element. However, custom attributes may not belong to any XML namespace that is reserved for SSDL. The fully-qualified names for any two custom attributes cannot be the same.

Example

The following example shows an EntityContainer element that has two EntitySet elements and one AssociationSet element:

<EntityContainer Name="ExampleModelStoreContainer">
  <EntitySet Name="Customers" 
             EntityType="ExampleModel.Store.Customers" 
             Schema="dbo" />
  <EntitySet Name="Orders" 
             EntityType="ExampleModel.Store.Orders" 
             Schema="dbo" />
  <AssociationSet Name="FK_CustomerOrders" 
                  Association="ExampleModel.Store.FK_CustomerOrders">
    <End Role="Customers" EntitySet="Customers" />
    <End Role="Orders" EntitySet="Orders" />
  </AssociationSet>
</EntityContainer>

See Also

Concepts

Entity Framework Overview
SSDL Specification

Other Resources

CSDL, SSDL, and MSL Specifications
ADO.NET Entity Data Model Tools