Each eConnect assembly defines a namespace for the classes that it contains. A .NET namespace is a second organizational method that groups type names in a effort to reduce the chance of a name collision. The eConnect namespaces are as follows:
You typically includes the namespace when you specify the type of an eConnect object. To demonstrate the use of a namespace, the following Visual Basic example instantiates a GetSopNumber object. Notice how the namespace and class name are used to specify the object type:
'Use GetSopNumber from the Microsoft.Dynamics.GP.eConnect 'namespace Dim SopNumber As New Microsoft.Dynamics.GP.eConnect.GetSopNumber
To simplify your code, use the Visual Basic Importsstatement or C# usingstatement to specify the namespace from a referenced assembly. These statements eliminate the need to include the namespace when you specify an object type.
The following Visual Basic example uses the Importsstatement to add the Microsoft.Dynamics.GP.eConnect namespace to the .vb file of a project. You typically add the Imports statement to the top of the file where you are using the members of that namespace:
The following C# example shows how to add a usingstatement to include namespace information in the .cs file of a project. You typically add the using statement to the top of the file:
After you use the Imports or using statements to include a namespace, you can use the eConnect class name to specify the type of an object. The following Visual Basic example shows how to import the Microsoft.Dynamics.GP.eConnect namespace and then instantiate a GetSopNumber object.
Imports Microsoft.Dynamics.GP.eConnect 'Use GetSopNumber from the Microsoft.Dynamics.GP.eConnect namespace Dim SopNumber As New GetSopNumber
If you are using the eConnect Integration Service you can use Imports or using statements for the service reference. The following Visual Basic example shows how to import the service reference for an application named VbTestApp.
The following C# code example shows how to add a using statement for a service reference to an application named ServiceTestApp.