/// <summary> /// Create an instance of ILocalDataSource through reflection on the LocalDataSourceAssembly. /// Or return an external ILocalDataSource object given by a client. /// </summary> /// <returns></returns> private ILocalDataSource CreateLocalDataSource() { Type localDataSourceType = null; if (!String.IsNullOrEmpty(syncItem.LocalDataSourceAssembly)) { localDataSourceType = FindLocalDataSourceTypeInAssembly(); if (localDataSourceType == null) { return(null); } } try { object filter = syncItem.GetFilter(); object handle; if (filter == null) { handle = Activator.CreateInstance(localDataSourceType, new object[] { syncItem.DataFormat }); } else { handle = Activator.CreateInstance(localDataSourceType, new object[] { syncItem.DataFormat, filter }); } ILocalDataSource source = (ILocalDataSource)handle; // source.ExchangeType = syncItem.DataFormat; return(source); } catch (TargetInvocationException e) { Trace.TraceInformation("When LoadLocalDataSource: " + e.Message); return(null); } }