Use OData to Return and Obtain a Service Metadata 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 Business Central, 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 Business Central implementation of EDM follows the .NET 4.0 WCF Data Service Framework implementation.

The following guidelines have been implemented for EDM.

  • Business Central 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.

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 Business Central Web client. See Publishing a Web Service..

  2. Start a supported web browser, such as Microsoft Edge. In the Address field, enter a URI in this format:

    https://<Server>:<WebServicePort>/<ServerInstance>/ODataV4/$metadata  
    

    If Business Central Server is running on the local computer and is using the default Business Central Server instance and OData port, then the address is:

    https://localhost:7048/<server instance>/ODataV4/$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.

OData Web Services