See :- Integrate Data Sync with 3rd Party Systems Part 1.
For users that do not have Visual Studio 2010 you can download the free Visual Web Developer Express 2010 from Microsoft and develop the Web Service with this version of Visual Studio here.
Once installed simply copy the web service code from the download into your my documents folder to start working with the web service code.
Then double click on the solution file to open the project in Visual Studio which will then open like this.
The sample project includes a very basic data source called "DefaultDataSource" under the "DataSources" folder you can open this and see how it works.
If you put breakpoints on the GetDefaultSchema() and GetData() methods you can then step into the code as it runs. Press F5 to run the project and IE will start showing the default Web Page for the service.
Now connect Data Sync to the service
When you click OK your first breakpoint GetDefaultSchema() will be hit where Data Sync requests information from your Data Service about the Schema.
Hit F5 to continue and the Data Source is loaded into Data Sync like this.
Now in Data Sync click the Preview A toolbar button on the Schema Map and then the GetData() method will be hit.
Hitting F5 again returns you to Data Sync and the Data is displayed from the service.
As you can see developing a custom web service to connect to your data source is quite simple. We used a simple SOAP WebService rather than WCF to keep it simple and we also kept the code simple rather than use any fancy code. You can add additional Data Sources to the Service by copying the DefaultDataSource class and adding it in the DataSourceList class. These are then available on the DataSource Dropdown when you connect in Data Sync.
using System; using System.Collections.Generic;
namespace DataSyncService.DataSources { class DataSourceList { public static Dictionary<string, Type> GetDataSources() { Dictionary<string, Type> result = new Dictionary<string, Type>();
//Add Datasources here....
result.Add("Default", typeof(DefaultDataSource));
return result;
}
}
}