public void Initialize(FileSyncInfo syncInfo) { try { Configure(syncInfo); } catch (Exception ex) { throw new FaultException <WebSyncFaultException>(new WebSyncFaultException(string.Format("Unable to initialize a file provider at {0}.", syncInfo.ReplicaRootPath), ex)); } }
public FileServerSyncProviderProxy(string syncAction, string replicaRootPath, string[] filters, FileSyncOptions syncOptions, string serviceUri, string syncClass = null) { ServiceUri = serviceUri; Proxy = CreateProxy(); try { FileSyncInfo syncInfo = new FileSyncInfo(syncAction, replicaRootPath, filters, syncOptions); if (!string.IsNullOrEmpty(syncClass)) { syncInfo.ServerSyncClass = syncClass; } Proxy.Initialize(syncInfo); } catch (Exception ex) { throw ex; } }
protected override void Configure(FileSyncInfo syncInfo) { Type type = Type.GetType(syncInfo.ServerSyncClass); if (type == null) { throw new FaultException <WebSyncFaultException>(new WebSyncFaultException(string.Format("Server Sync Class {0} is not supported.", syncInfo.ServerSyncClass), null)); } try { _serverSync = (FileServerSync)Activator.CreateInstance(type); _serverSync.Configure(syncInfo.SyncAction, syncInfo.ReplicaRootPath, syncInfo.Filters, syncInfo.SyncOptions); Provider = _serverSync.Provider; } catch (Exception ex) { throw new FaultException <WebSyncFaultException>(new WebSyncFaultException(string.Format("Cannot configure file server sync service for {0} at {1}.", syncInfo.ServerSyncClass, syncInfo.ReplicaRootPath), ex)); } }
protected abstract void Configure(FileSyncInfo syncInfo);