Extend the metadata [AX 2012]

Updated: April 29, 2014

Applies To: Microsoft Dynamics AX 2012 R3

When you use OData with Microsoft Dynamics AX for Retail, metadata defines the contract between a client and server. It exposes entity definitions and action definitions, so when you make a change on the server side, you can use a tool on the client side to generate proxy code, reducing maintenance effort for developers. To consume new or changed entities and actions, you must extend the metadata.


You can find the sample code from this topic in the Retail SDK.

Retail Server has a default metadata controller called CommerceModelFactory. To extend the default controller, you create a new class that uses the Export attribute along with the IEdmModelFactory interface. Then you can add and override existing code. For example, you can add new entity sets, new actions, new complex types, or new exception types.

In the following example, the ExtendedEdmModelFactory class extends the CommerceModelFactory metadata controller and creates a new action called NewAction and a new entity set called NewEntities.

namespace Microsoft.Dynamics.RetailServer.Samples.Extensions
    using System.ComponentModel.Composition;
    using Microsoft.Dynamics.Retail.StoreServerServiceLibrary;

    public class ExtendedEdmModelFactory : CommerceModelFactory
        protected override void BuildNonBindableActions()

            var NewAction = BindAction("NewAction");

        protected override void BuildEntitySets()


Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).