PHP K T N I CSDL

0 views
Skip to first unread message
Message has been deleted

Oleta Blaylock

unread,
Jul 10, 2024, 7:15:33 PM7/10/24
to liatalpite

Conceptual schema definition language (CSDL) is an XML-based language that describes the entities, relationships, and functions that make up a conceptual model of a data-driven application. This conceptual model can be used by the Entity Framework or WCF Data Services. The metadata that is described with CSDL is used by the Entity Framework to map entities and relationships that are defined in a conceptual model to a data source. For more information, see SSDL Specification and MSL Specification.

PHP K t N i CSDL


Download >>> https://bytlly.com/2yLv3K



In an Entity Framework application, conceptual model metadata is loaded from a .csdl file (written in CSDL) into an instance of the System.Data.Metadata.Edm.EdmItemCollection and is accessible by using methods in the System.Data.Metadata.Edm.MetadataWorkspace class. Entity Framework uses conceptual model metadata to translate queries against the conceptual model to data source-specific commands.

The EF Designer stores conceptual model information in an .edmx file at design time. At build time, the EF Designer uses information in an .edmx file to create the .csdl file that is needed by Entity Framework at runtime.

An Association element defines a relationship between two entity types. An association must specify the entity types that are involved in the relationship and the possible number of entity types at each end of the relationship, which is known as the multiplicity. The multiplicity of an association end can have a value of one (1), zero or one (0..1), or many (*). This information is specified in two child End elements.

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

The following example shows an Association element that defines the CustomerOrders association when foreign keys have been exposed on the Customer and Order entity types. With foreign keys exposed, the relationship between the entities is managed with a ReferentialConstraint element. A corresponding AssociationSetMapping element is not necessary to map this association to the data source.

The AssociationSet element in conceptual schema definition language (CSDL) is a logical container for association instances of the same type. An association set provides a definition for grouping association instances so that they can be mapped to a data source.

The Association attribute specifies the type of association that an association set contains. The entity sets that make up the ends of an association set are specified with exactly two child End elements.

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

The CollectionType element in conceptual schema definition language (CSDL) specifies that a function parameter or function return type is a collection. The CollectionType element can be a child of the Parameter element or the ReturnType (Function) element. The type of collection can be specified by using either the Type attribute or one of the following child elements:

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

The following example shows a model-defined function that that uses a CollectionType element to specify that the function returns a collection of Person entity types (as specified with the ElementType attribute).

The following example shows a model-defined function that uses a CollectionType element to specify that the function returns a collection of rows (as specified in the RowType element).

The following example shows a model-defined function that uses the CollectionType element to specify that the function accepts as a parameter a collection of Department entity types.

A ComplexType element defines a data structure composed of EdmSimpleType properties or other complex types. A complex type can be a property of an entity type or another complex type. A complex type is similar to an entity type in that a complex type defines data. However, there are some key differences between complex types and entity types:

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

To define the complex type Address (above) as a property of an entity type, you must declare the property type in the entity type definition. The following example shows the Address property as a complex type on an entity type (Publisher):

For validation purposes, a DefiningExpression element can contain arbitrary content. However, Entity Framework will throw an exception at runtime if a DefiningExpression element does not contain valid Entity SQL.

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

The following example uses a DefiningExpression element to define a function that returns the number of years since a book was published. The content of the DefiningExpression element is written in Entity SQL.

The Dependent element in conceptual schema definition language (CSDL) is a child element to the ReferentialConstraint element and defines the dependent end of a referential constraint. A ReferentialConstraint element defines functionality that is similar to a referential integrity constraint in a relational database. In the same way that a column (or columns) from a database table can reference the primary key of another table, a property (or properties) of an entity type can reference the entity key of another entity type. The entity type that is referenced is called the principal end of the constraint. The entity type that references the principal end is called the dependent end of the constraint. PropertyRef elements are used to specify which keys reference the principal end.

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

The following example shows a ReferentialConstraint element being used as part of the definition of the PublishedBy association. The PublisherId property of the Book entity type makes up the dependent end of the referential constraint.

The Documentation element in conceptual schema definition language (CSDL) can be used to provide information about an object that is defined in a parent element. In an .edmx file, when the Documentation element is a child of an element that appears as an object on the design surface of the EF Designer (such as an entity, association, or property), the contents of the Documentation element will appear in the Visual Studio Properties window for the object.

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

The following example shows the Documentation element as a child element of an EntityType element. If the snippet below were in the CSDL content of an .edmx file, the contents of the Summary and LongDescription elements would appear in the Visual Studio Properties window when you click on the Customer entity type.

The End element in conceptual schema definition language (CSDL) can be a child of the Association element or the AssociationSet element. In each case, the role of the End element is different and the applicable attributes are different.

An End element (as a child of the Association element) identifies the entity type on one end of an association and the number of entity type instances that can exist at that end of an association. Association ends are defined as part of an association; an association must have exactly two association ends. Entity type instances at one end of an association can be accessed through navigation properties or foreign keys if they are exposed on an entity type.

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

The End element specifies one end of an association set. The AssociationSet element must contain two End elements. The information contained in an End element is used in mapping an association set to a data source.

7fc3f7cf58
Reply all
Reply to author
Forward
0 new messages