In Dynamics NAV we write our code in C/AL, and this has been that way for ever. But NAV now runs on .NET and how does that work.
Well the truth is that C/AL is only there for the NAV programmer, and is NOT used in running NAV. Its only used in the Development Environment.
WHAT, not use in NAV….
C/AL is on compilation transformed into C# (csharp), and it is this code that runs on the server. This happens in the Object Metadata table. Lets have a look.
All object have a record in the Object Metadata table.
In the Metadata field we have table layout in XML.
In the “User AL Code” field we have all the C/AL code.
And in the “User Code” field we have the translated C# code that is used to run NAV.
Want to see the code, easy.
// Export the C# code for Codeunit 80 ObjectMetaData.GET(ObjectMetaData."Object Type"::Codeunit, 80); ObjectMetaData.CALCFIELDS("User Code", "User Code"); ObjectMetaData."User Code".CREATEINSTREAM(CodeInStream); CodeFile.CREATE('c:\temp\objectcode.txt'); CodeFile.CREATEOUTSTREAM(CodeOutStream); COPYSTREAM(CodeOutStream, CodeInStream); CodeFile.CLOSE();