.Net BC Custom App, Part III - Container Object
Well now we have talked a bit about design let's look into some sample C# code that works with different objects from Dynamics AX. First I want to take an object that is used a lot most likely in code, and can be very useful. That is a Container Object.
Working with an Container object from C#:
AxaptaContainer axContainer;
axContainer = (AxaptaContainer)objDAXCn.Call(StaticClassMethod"someClass","someStaticMethod",Var1,Var2,var3);
for (int i = 1; i <= axContainer.Count; i++)
{
// Preform Some code here on the returned container....
someStr = axContainer.get_Item(1).ToString();
}
Here we see exactly how to work with a Conatiner object from C#, and use a for loop call to enumerate through the container to work with the container elements. What makes the above path calls possible, is the header of the C# code contains the following:
using Microsoft.Dynamics.BusinessConnectorNet;
So we see now that if we had a static method on a class that could be coded to maybe get some data, and put that into a container object, then the above code could enumerate through that container and within C# you could work with that conatiners elements. I will continue down this path of of working with .Net BC and objects from
Dynamics AX via C#. I hope that you are enjoying this and that it helps someone out!
Check back soon!
Find a job at: www.DynamicsAXJobs.com
Working with an Container object from C#:
AxaptaContainer axContainer;
axContainer = (AxaptaContainer)objDAXCn.Call(StaticClassMethod"someClass","someStaticMethod",Var1,Var2,var3);
for (int i = 1; i <= axContainer.Count; i++)
{
// Preform Some code here on the returned container....
someStr = axContainer.get_Item(1).ToString();
}
Here we see exactly how to work with a Conatiner object from C#, and use a for loop call to enumerate through the container to work with the container elements. What makes the above path calls possible, is the header of the C# code contains the following:
using Microsoft.Dynamics.BusinessConnectorNet;
So we see now that if we had a static method on a class that could be coded to maybe get some data, and put that into a container object, then the above code could enumerate through that container and within C# you could work with that conatiners elements. I will continue down this path of of working with .Net BC and objects from
Dynamics AX via C#. I hope that you are enjoying this and that it helps someone out!
Check back soon!
Find a job at: www.DynamicsAXJobs.com
Labels: .Net, .Net BC, ASP.Net, Business Connector, C#, Container, Custom, Dynamics AX











