Migrating .NET Code to Magic xpa Code (Magic xpa 3.x)
Use the following frequently asked questions and answers to help you migrate .NET code to Magic xpa code.
Which assemblies do I need to refer to?
In order to use the assemblies, you need to add a reference to them in the Magic xpa CRR.
The 1st thing you need to do is to figure out which assembly you should refer to.
This information can most likely be found in the vendors page or using Google.
For example, the ‘PivotArea’ enumeration in DevXpress (referred in http://documentation.devexpress.com/#WindowsForms/CustomDocument1921) can be found in the DevExpress.PivotGrid.v11.1.Core.dll assembly (as specified in http://documentation.devexpress.com/#CoreLibraries/DevExpressXtraPivotGridPivotAreaEnumtopic)
How do I migrate the equal (‘=’) operation in .NET to Magic xpa?
If you want to set a property of an object, you need to use the DNSet(property,value) function.
For example: the ‘fieldOrderDate.AreaIndex = 0;’ sentence should be written as DNSet(A.AreaIndex,0)
Where A is a .NET variable (fieldOrderDate) and AreaIndex is its property, which will be updated with the value of zero.
How do I migrate the ‘Type Var’ operation in .NET to Magic xpa?
When you have a ‘Type Var’ combination, it mostly means that you should define a .NET variable.
For example: the ‘DataTable sourceData’ sentence should be defined as a new virtual field (named ‘sourceData’) of .NET attribute and object type of ‘System.Data.DataTable’.
How do I migrate the ‘New’ operation in .NET to Magic xpa?
Update of a .NET object is mostly done to instantiate an object.
For example: the ‘DataTable sourceData = new DataTable();’ sentence should be written as Update A with DotNet.System.Data.DataTable() where A is a .NET variable of type ‘System.Data.DataTable’.
How do I get a value of .NET object properties or call a .NET method?
The ‘XX.YY’ notation is used for both getting properties' values and running methods.
For example: DotNet.DevExpress.XtraPivotGrid.PivotArea.RowArea
How do I migrate the curly brackets (‘{}’) operation in .NET to Magic xpa?
The curly brackets are used mostly to fill a .NET array with some initial value.
In Magic xpa you need to set the .NET array cell one after the other.
For example: the ‘MyRange = new Object[] {“aaa”,”bbb” }’ statement is actually built from two parts:
-
-
Instantiate the array:
Update A with DotNet.System.Object[2] where A is a .NET variable of type ‘System.Object[]’
This is equivalent to the ‘MyRange = new Object[]’ statement.
-
Fill in the data:
DNSet(A[0],’aaa’)
DNSet(A[1],’bbb’)