Adapter components of the Connector SDK (2nd in the SDK series)


This is the 2nd in a 5-part series covering the basics of the SDK for Connector.

The Adapter

We’ll start with “A” for Adapter. The Adapter is a critical piece of Connector for Microsoft Dynamics. Without it, you can’t interface with another system. This post explains some of the highlights of the Adapter template and sample code including settings, the use of IDisposable, and the necessary “using” statements for an Adapter.

What settings are in the Adapter?

The Adapter has a number of settings inherited from the base Adapter class in the AAL DLL. These include

  • ·         DisplayName – The name as it will be displayed in the client application.
  • ·         Id – The GUID that will uniquely identify this adapter.
  • ·         Description – A string describing the adapter and its purpose.
  • ·         webServiceContext – The context that should be used when interacting with a web service.
  • ·         companyKey – The key that uniquely identifies the company that the Adapter binds to.
  • ·         webService – The web service that the Adapter uses to connect to a system.

In the InitializeSettings() method, there is also some settings including username, password, company, and webServiceUrl. They are pretty straightforward and do not need to be hard-coded as the client application will request this information when you first install the files in the Adapters folder.

Should I implement and use IDisposable?

Generally, when dealing with web services it is advisable to properly implement and utilize IDisposable to release resources that are being used by the Adapter. The SampleAdapter has IDisposable implemented and provides an example of how to implement IDisposable when using Web Services.

What other “using” statements will I need to add to the Adapter?

 The templates include a couple simple “using” statements that include the base namespaces for the templates. However, in the SampleAdapter, there are more namespaces used. For most Adapter that you write, you’ll probably need to add a least a couple of these namespaces:

  • ·         Microsoft.Dynamics.Integration.Common
  • ·         System.Net
  • ·         System.Collections.Generic

 

Other namespaces may need to be used depending upon your specific implementation and needs.

Comments (2)

  1. iortega says:

    Hi,

    Im trying to develop for SDK and I wonder if you can provide some samples for AX2009. SDK only comes with sames for GP.

  2. thehetz says:

    @iortega – we do not have any AX 2009 samples.  You may be able to use .NET Peek, .NET Reflector, or another IL tool to view the existing AX 2009 adapter's code and use that as a starting point.