Pages

Thursday, September 14, 2017

Sample loop through metadata of model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.Dynamics.AX.Metadata.Management;
using Microsoft.Dynamics.AX.Metadata.Modeling;
using Microsoft.Dynamics.AX.Metadata.Storage;
using Microsoft.Dynamics.AX.Metadata.Providers;
using Microsoft.Dynamics.AX.Metadata.MetaModel;

namespace MetaDataExample
{
    class Program
    {
        static void Main(string[] args)
        {
            string packagesLocalDirectory = @"J:\AosService\PackagesLocalDirectory";
            IMetadataProvider diskMetadataProvider = new MetadataProviderFactory().CreateDiskProvider(packagesLocalDirectory);

            var l = diskMetadataProvider.Tables.ListObjects("MyModelName");
            var le = l.GetEnumerator();

            while (le.MoveNext())
            {
                AxTable t = diskMetadataProvider.Tables.Read(le.Current);
                Console.WriteLine(t.Name);
            }

            Console.ReadKey();
        }

    }
}

Wednesday, September 6, 2017

Important caveat with the "Chain of command" (CoC) feature

If you use CoC with the July 2017 application release, you need to compile and deploy the standard models you eventually use CoC with. The reason being that the standard models are compiled with Update 8 which didn't have CoC.

This is a temporary inconvenience, and will not be necessary after the "Autum" release.

So, if you write ISV/VAR solutions, you might want to postpone usage of CoC for anything you release before the "Autum" release.