Partilhar via


EntityContainer Element (SSDL)

An EntityContainer element in store schema definition language (SSDL) describes the structure of the underlying data source in an Entity Framework application: SSDL entity sets (defined in EntitySet elements) represent tables in a database, SSDL entity types (defined in EntityType elements) represent rows in a table, and association sets (defined in AssociationSet elements) represent foreign key constraints in a database. A storage model entity container maps to a conceptual model entity container through the EntityContainerMapping element.

An EntityContainer element can have zero or one Documentation elements. If a Documentation element is present, it must precede all other child elements.

An EntityContainer element can have zero or more of the following child elements (in the order listed):

Applicable Attributes

The table below describes the attributes that can be applied to the EntityContainer element.

Attribute Name Is Required Value

Name

Yes

The name of the entity container. This name cannot contain periods (.).

Note

Any number of annotation attributes (custom XML attributes) may be applied to the EntityContainer 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 defines two entity sets and one association set. Note that entity type and association type names are qualified by the conceptual model namespace name.

<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