CSDL Specification

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.

CSDL is the Entity Framework's implementation of the Entity Data Model.

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. The Entity Framework uses conceptual model metadata to translate queries against the conceptual model to data source-specific commands.


The Entity Data Model Designer (Entity Designer) stores conceptual model information in an .edmx file at design time. At build time, the Entity Designer uses information in an .edmx file to create the .csdl file that is needed by the Entity Framework at runtime. For more information, see .edmx File Overview.

The conceptual model metadata can be used to generate the object-layer code for an Entity Framework application. For more information, see Generated Code Overview (Entity Data Model Designer) and How to: Use EdmGen.exe to Generate Object-Layer Code.

The XML schema for the .csdl file can be found in the XML\Schemas folder of your Visual Studio installation directory (for example, C:\Program Files\Microsoft Visual Studio 10.0\Xml\Schemas). The schema for applications that target the .NET Framework version 4 is defined in the System.Data.Resources.CSDLSchema_2.xsd file. The schema for applications that target the .NET Framework version 3.5 SP1 is defined in the System.Data.Resources.CSDLSchema_1.xsd file.


Versions of CSDL are differentiated by XML namespaces. The http://schemas.microsoft.com/ado/2008/09/edm namespace is for conceptual models in applications that target the .NET Framework 4. The http://schemas.microsoft.com/ado/2006/04/edm namespace is for conceptual models in applications that target the .NET Framework 3.5 SP1. For information about other CSDL versions and their uses, see ADO.NET Data Services.

In This Section

Association Element (CSDL)

AssociationSet Element (CSDL)

CollectionType Element (CSDL)

ComplexType Element (CSDL)

DefiningExpression Element (CSDL)

Dependent Element (CSDL)

Documentation Element (CSDL)

End Element (CSDL)

EntityContainer Element (CSDL)

EntitySet Element (CSDL)

EntityType Element (CSDL)

Function Element (CSDL)

FunctionImport Element (CSDL)

Key Element (CSDL)

NavigationProperty Element (CSDL)

OnDelete Element (CSDL)

Parameter Element (CSDL)

Principal Element (CSDL)

Property Element (CSDL)

PropertyRef Element (CSDL)

ReferenceType Element (CSDL)

ReferentialConstraint Element (CSDL)

ReturnType Element (CSDL)

RowType Element (CSDL)

Schema Element (CSDL)

TypeRef Element (CSDL)

Using Element (CSDL)

Annotation Attributes (CSDL)

Annotation Elements (CSDL)

Conceptual Model Types (CSDL)

Facets (CSDL)

See Also


Entity Framework Overview

Other Resources

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