static void CleanUpProvider(KnowledgeSyncProvider provider) { AppointmentSyncProvider outlookProvider = provider as AppointmentSyncProvider; CalendarEventSyncProvider ibnProvider = provider as CalendarEventSyncProvider; if (outlookProvider != null) { // Remove the data store file string metafile = outlookProvider.CurrentSetting.CurrentSyncAppSetting.metaDataFileName; if (System.IO.File.Exists(metafile)) { System.IO.File.Delete(metafile); } } else if (ibnProvider != null) { FilterElement filterEl = new FilterElement(SynchronizationMetadataRow.ColumnReplicaId, FilterElementType.Equal, ibnProvider.ReplicaId.GetGuidId()); foreach (SynchronizationMetadataRow row in SynchronizationMetadataRow.List(filterEl)) { BusinessManager.Delete(new CalendarEventEntity((PrimaryKeyId)row.Uri)); row.Delete(); } SynchronizationReplicaRow.Delete(ibnProvider.ReplicaId.GetGuidId()); } }
static KnowledgeSyncProvider GetProviderForSynchronization(Guid replicaId) { KnowledgeSyncProvider retVal = null; // Return the real provider for endpoint A. if (replicaId == providerNameA) { retVal = CalendarEventSyncProvider.CreateInstance(Mediachase.Ibn.Data.Services.Security.CurrentUserId); } else if (replicaId == providerNameB) { retVal = new AppointmentSyncProvider(); } else { throw new ArgumentOutOfRangeException("name"); } return(retVal); }