ObjectProvider components of Connector SDK (3rd in the SDK series)
This is the 3rd in a 5-part series covering the basics of the SDK for Connector.
The ObjectProviders
Another critical piece of Connector is the ObjectProviders. The ObjectProviders allow Connector to update, delete, and create objects of a specific type in the systems being connected. For example, the SampleAdapter comes with a SampleCustomerObjectProvider that defines how to keep Customer objects in sync between two systems. This post is going to cover some topics relevant to the ObjectProviders, including an overview of the SampleCustomerObjectProvider, SampleUofMScheduleObjectProvider, the types of ObjectProviders, the query used in some methods of an ObjectProvider, and “using” statements.
The SampleCustomerObjectProvider
This ObjectProvider illustrates how a mixed object provider (one that implements both IObjectReader and IObjectWriter interfaces) is setup. In this case, a Customer object could be both read and written from a system. This is also why there are lots of methods to be implemented in this kind of ObjectProvider.
The SampleUofMScheduleObjectProvider
This ObjectProvider illustrates a very simple example of an ObjectProvider that implements only the IObjectReader interface. Thus, it can only be read from a system. It is fairly simple and straightforward. This is a good starting point for ObjectProviders.
What kinds of ObjectProviders are there?
ObjectProviders can take three different forms: destination, source, and mixed. Destination ObjectProviders implement the IObjectWriter interface and can be used to write objects to a system. Source ObjectProviders implement the IObjectReader interface and can be used to read objects from a system. Finally, mixed ObjectProviders implement both the IObjectWriter and IObjectReader interfaces so that you can read and write this object from and to a system. Think of source and destination as one-way ObjectProviders and mixed as two-way ObjectProviders.
What is the deal with this DateTime parameter in some methods?
Some methods in the ObjectProviders that are provided by the IObjectReader interface take a parameter called “query” that is of type System.DateTime. This represents the last time that the integration service was run. So, the idea is to pickup any changes that have happened since the last time the integration service was run. You’ll notice in the sample code that inside methods like ReadDeletedObjectKeys(), we use the query DateTime object as the value for the LastModifiedDate attribute of the criteria. So, when we request all objects that have been changes since the last run of the integration service, we’ll receive them.
What other “using” statements will I need to add to the ObjectProviders?
When you utilize the ObjectProvider templates, you may need to implement some of the following namespaces with a “using” statement:
- · System.Web.Services.Protocols
- · System.Linq
- · System.Collections
- · System.Collections.ObjectModel
You may not need to implement all of these namespaces for your specific implementation, but they may be required particularly if you are interacting with web services.