public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration configuration) { Assert.ArgumentNotNull(targetDataStore, "serializationProvider"); Assert.ArgumentNotNull(predicate, "predicate"); Assert.ArgumentNotNull(fieldFilter, "fieldPredicate"); Assert.ArgumentNotNull(logger, "logger"); Assert.ArgumentNotNull(sourceDataStore, "sourceDataStore"); Assert.ArgumentNotNull(configuration, "configuration"); _logger = logger; _configuration = configuration; _predicate = predicate; _fieldFilter = fieldFilter; _targetDataStore = targetDataStore; _sourceDataStore = sourceDataStore; try { _targetDataStore.RegisterForChanges(RemoveItemFromCaches); } catch (NotImplementedException) { // if the data store doesn't implement watching, cool story bruv } }
// TODO private UnicornDataProvider CreateTestProvider(Database db, ITargetDataStore targetDataStore = null, ISourceDataStore sourceDataStore = null, IPredicate predicate = null, IFieldFilter filter = null, IUnicornDataProviderLogger logger = null, bool enableTransparentSync = false) { if (predicate == null) { predicate = CreateInclusiveTestPredicate(); } if (filter == null) { filter = Substitute.For<IFieldFilter>(); filter.Includes(Arg.Any<Guid>()).Returns(true); } targetDataStore = targetDataStore ?? Substitute.For<ITargetDataStore>(); sourceDataStore = sourceDataStore ?? Substitute.For<ISourceDataStore>(); var dp = new UnicornDataProvider(targetDataStore, sourceDataStore, predicate, filter, logger ?? Substitute.For<IUnicornDataProviderLogger>(), new DefaultUnicornDataProviderConfiguration(enableTransparentSync), new PredicateRootPathResolver(predicate, targetDataStore, sourceDataStore, Substitute.For<ILogger>())); dp.ParentDataProvider = db.GetDataProviders().First(); return dp; }
public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration dataProviderConfiguration, PredicateRootPathResolver rootPathResolver) { Assert.ArgumentNotNull(targetDataStore, "serializationProvider"); Assert.ArgumentNotNull(predicate, "predicate"); Assert.ArgumentNotNull(fieldFilter, "fieldPredicate"); Assert.ArgumentNotNull(logger, "logger"); Assert.ArgumentNotNull(sourceDataStore, "sourceDataStore"); Assert.ArgumentNotNull(dataProviderConfiguration, "configuration"); Assert.ArgumentNotNull(rootPathResolver, "rootPathResolver"); _logger = logger; _dataProviderConfiguration = dataProviderConfiguration; _rootPathResolver = rootPathResolver; _predicate = predicate; _fieldFilter = fieldFilter; _targetDataStore = targetDataStore; _sourceDataStore = sourceDataStore; // enable capturing recycle bin and archive restores to serialize the target item if included EventManager.Subscribe <RestoreItemCompletedEvent>(HandleItemRestored); try { _targetDataStore.RegisterForChanges(RemoveItemFromCaches); } catch (NotImplementedException) { // if the data store doesn't implement watching, cool story bruv } }
public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration configuration) { Assert.ArgumentNotNull(targetDataStore, "serializationProvider"); Assert.ArgumentNotNull(predicate, "predicate"); Assert.ArgumentNotNull(fieldFilter, "fieldPredicate"); Assert.ArgumentNotNull(logger, "logger"); Assert.ArgumentNotNull(sourceDataStore, "sourceDataStore"); Assert.ArgumentNotNull(configuration, "configuration"); _logger = logger; _disableTransparentSync = !configuration.EnableTransparentSync; _predicate = predicate; _fieldFilter = fieldFilter; _targetDataStore = targetDataStore; _sourceDataStore = sourceDataStore; try { _targetDataStore.RegisterForChanges(RemoveItemFromCaches); } catch (NotImplementedException) { // if the data store doesn't implement watching, cool story bruv } }
public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration dataProviderConfiguration, ISyncConfiguration syncConfiguration, PredicateRootPathResolver rootPathResolver) { Assert.ArgumentNotNull(targetDataStore, nameof(targetDataStore)); Assert.ArgumentNotNull(predicate, nameof(predicate)); Assert.ArgumentNotNull(fieldFilter, nameof(fieldFilter)); Assert.ArgumentNotNull(logger, nameof(logger)); Assert.ArgumentNotNull(sourceDataStore, nameof(sourceDataStore)); Assert.ArgumentNotNull(dataProviderConfiguration, nameof(dataProviderConfiguration)); Assert.ArgumentNotNull(rootPathResolver, nameof(rootPathResolver)); Assert.ArgumentNotNull(syncConfiguration, nameof(syncConfiguration)); _logger = logger; _dataProviderConfiguration = dataProviderConfiguration; _syncConfiguration = syncConfiguration; _rootPathResolver = rootPathResolver; _predicate = predicate; _fieldFilter = fieldFilter; _targetDataStore = targetDataStore; _sourceDataStore = sourceDataStore; // enable capturing recycle bin and archive restores to serialize the target item if included EventManager.Subscribe<RestoreItemCompletedEvent>(HandleItemRestored); try { _targetDataStore.RegisterForChanges(RemoveItemFromCaches); } catch (NotImplementedException) { // if the data store doesn't implement watching, cool story bruv } }
public UnicornDataProvider(ISerializationProvider serializationProvider, IPredicate predicate, IFieldPredicate fieldPredicate, IUnicornDataProviderLogger logger) { Assert.ArgumentNotNull(serializationProvider, "serializationProvider"); Assert.ArgumentNotNull(predicate, "predicate"); Assert.ArgumentNotNull(fieldPredicate, "fieldPredicate"); Assert.ArgumentNotNull(logger, "logger"); _logger = logger; _predicate = predicate; _fieldPredicate = fieldPredicate; _serializationProvider = serializationProvider; }
// TODO private UnicornDataProvider CreateTestProvider(Database db, ITargetDataStore targetDataStore = null, ISourceDataStore sourceDataStore = null, IPredicate predicate = null, IFieldFilter filter = null, IUnicornDataProviderLogger logger = null, ISyncConfiguration syncConfiguration = null, bool enableTransparentSync = false) { if (predicate == null) { predicate = CreateInclusiveTestPredicate(); } if (filter == null) { filter = Substitute.For <IFieldFilter>(); filter.Includes(Arg.Any <Guid>()).Returns(true); } targetDataStore = targetDataStore ?? Substitute.For <ITargetDataStore>(); sourceDataStore = sourceDataStore ?? Substitute.For <ISourceDataStore>(); syncConfiguration = syncConfiguration ?? Substitute.For <ISyncConfiguration>(); var dp = new UnicornDataProvider(targetDataStore, sourceDataStore, predicate, filter, logger ?? Substitute.For <IUnicornDataProviderLogger>(), new DefaultUnicornDataProviderConfiguration(enableTransparentSync), syncConfiguration, new PredicateRootPathResolver(predicate, targetDataStore, sourceDataStore, Substitute.For <ILogger>())); dp.ParentDataProvider = db.GetDataProviders().First(); return(dp); }