public async Task Synchronize(ISynchronizationLogger logger, TContext synchronizationContext) { s_logger.InfoFormat("Entered. Syncstrategy '{0}' with Atype='{1}' and Btype='{2}'", _initialSyncStateCreationStrategy.GetType().Name, typeof(TAtypeEntity).Name, typeof(TBtypeEntity).Name); using (var totalProgress = _totalProgressFactory.Create()) { var knownEntityRelations = _entityRelationDataAccess.LoadEntityRelationData() ?? new IEntityRelationData <TAtypeEntityId, TAtypeEntityVersion, TBtypeEntityId, TBtypeEntityVersion>[] { }; var stateTokens = _stateTokenDataAccess.LoadKnownStateTokens(); using (var interceptor = _synchronizationInterceptorFactory.Create()) { var aStatesTask = _atypeStateAwareEntityRepository.GetFullRepositoryState(knownEntityRelations.Select(r => r.AtypeId), stateTokens.AToken, synchronizationContext, logger.AGetVersionsEntityLogger); var bStatesTask = _btypeStateAwareEntityRepository.GetFullRepositoryState(knownEntityRelations.Select(r => r.BtypeId), stateTokens.BToken, synchronizationContext, logger.BGetVersionsEntityLogger); (var aStates, var newAToken) = await aStatesTask; (var bStates, var newBToken) = await bStatesTask; await Synchronize( totalProgress, knownEntityRelations, aStates, bStates, logger, synchronizationContext, interceptor, newEntityRelations => _entityRelationDataAccess.SaveEntityRelationData(newEntityRelations)); _stateTokenDataAccess.SaveKnownStateTokens(newAToken, newBToken); } } s_logger.DebugFormat("Exiting."); }
public async Task <(IEntityStateCollection <WebResourceName, string> States, string NewToken)> GetFullRepositoryState(IEnumerable <WebResourceName> idsOfknownEntities, string stateToken, ICardDavRepositoryLogger context, IGetVersionsLogger logger) { var result = await _inner.GetFullRepositoryState(idsOfknownEntities, stateToken, 0, logger); return(new LoggingEntityStateCollectionDecorator(result.States, context), result.NewToken); }
public async Task <(IEntityStateCollection <TEntityId, TEntityVersion> States, TStateToken NewToken)> GetFullRepositoryState(IEnumerable <TEntityId> idsOfknownEntities, TStateToken stateToken, TContext context, IGetVersionsLogger logger) { return(await Task.Run(() => _stateAwareEntityRepositoryImplementation.GetFullRepositoryState(idsOfknownEntities, stateToken, context, logger))); }