次の方法で共有


How to: Use OData to Return/Obtain a Service Metadata (EDMX) Document

The Entity Data Model (EDM) is a specification for defining the data that is used by applications that are built on the Entity Framework. EDMX is an XML-based file format that is the packaging format for the service metadata of a data service. When you interact with an OData service that is published from Microsoft Dynamics NAV, you can request EDM-based proxies and then use tools such as LINQ to create data access logic. LINQ is a programming model that developers can use to query data from a variety of data sources, including OData. For more information, see LINQ (Language-Integrated Query)

The Microsoft Dynamics NAV implementation of EDM follows the .NET 4.0 WCF Data Service Framework implementation.

The following guidelines have been implemented for EDM.

  • Microsoft Dynamics NAV field names are mapped to EDMX property names by replacing spaces with underscores.

  • Primary key fields in tables are automatically defined as properties in the service metadata document even if they are not exposed on a page as controls.

To obtain a service metadata (EDMX) document

  1. You can obtain service metadata documents for either page or query web services. This example uses a page web service. Register and publish a page web service by using the RoleTailored client. For more information, see Walkthrough: Creating and Interacting with a Page Web Service (OData).

  2. Start Windows Internet Explorer. In the Address field, enter a URI in this format:

     http://<Server>:<WebServicePort>/<ServerInstance>/OData/$metadata
    

    If Microsoft Dynamics NAV Server is running on the local computer and is using the default Microsoft Dynamics NAV Server instance and OData port, then the address is:

    https://localhost:7048/DynamicsNAV71/OData/$metadata
    

    The browser should now show the complete metadata for the page web service that you have published. The beginning of this document looks like this:

    EDMX metadata

See Also

Concepts

OData Web Services