internal static void AddRelation(this IEnumerable <ICoreRelationsRepository> session, IReadonlyRelation <IRelatableEntity, IRelatableEntity> relation, Uri idRoot) { foreach (var relationsRepository in session) { relationsRepository.AddRelation(relation); } GroupSessionHelper.MakeIdsAbsolute(relation, idRoot); }
internal static void Add <T>(this IEnumerable <IProviderRevisionRepository <T> > repositories, Revision <T> item, Uri idRoot) where T : class, IVersionableEntity { foreach (var revisionRepository in repositories) { revisionRepository.AddOrUpdate(item); } GroupSessionHelper.MakeIdsAbsolute(item, idRoot); }
internal static void AddOrUpdate <T>(this IEnumerable <ICoreRepository <T> > repositories, T item, Uri idRoot) where T : class, IReferenceByHiveId { //TODO: Determine which repo is the primary one //TODO: Ensure population of the incoming queue is sorted by Ordinal foreach (var repository in repositories) { repository.AddOrUpdate(item); } GroupSessionHelper.MakeIdsAbsolute(item, idRoot); }
internal static IEnumerable <Revision <T> > GetAll <T>(this IEnumerable <IReadonlyProviderRevisionRepository <T> > readonlyRepositories, HiveId entityId, Uri idRoot, RevisionStatusType revisionStatusType = null) where T : class, IVersionableEntity { //TODO: Determine which repo is the primary one //TODO: Ensure population of the incoming queue is sorted by Ordinal var totalOutput = new HashSet <Revision <T> >(); foreach (var reader in readonlyRepositories) { reader.GetAll <T>(entityId).SkipWhile(SkipAndMerge(reader, totalOutput)).ForEach(x => totalOutput.Add(x)); } return(totalOutput.DistinctBy(x => x.MetaData.Id).Select(x => GroupSessionHelper.MakeIdsAbsolute(x, idRoot))); }
internal static IEnumerable <Revision <TEntity> > GetLatestRevisions <TEntity>(this IEnumerable <IReadonlyProviderRevisionRepository <TEntity> > readonlyRepositories, bool allOrNothing, Uri idRoot, RevisionStatusType revisionStatusType = null, params HiveId[] entityIds) where TEntity : class, IVersionableEntity { Revision <TEntity> returnValue = null; var totalOutput = new HashSet <Revision <TEntity> >(); //TODO: Determine which repo is the primary one //TODO: Ensure population of the incoming queue is sorted by Ordinal foreach (var reader in readonlyRepositories) { reader.GetLatestRevisions <TEntity>(allOrNothing, revisionStatusType, entityIds).SkipWhile(SkipAndMerge(reader, totalOutput)).ForEach(x => totalOutput.Add(x)); } return(totalOutput.DistinctBy(x => x.MetaData.Id).Select(x => GroupSessionHelper.MakeIdsAbsolute(x, idRoot))); }
internal static T ProcessIdsAndGroupRelationProxyDelegate <T>(ICoreReadonlyRelationsRepository groupRepo, Uri idRoot, T returnValue) where T : class, IReferenceByHiveId { if (returnValue == null) { return(null); } GroupSessionHelper.MakeIdsAbsolute(returnValue, idRoot); if (TypeFinder.IsTypeAssignableFrom <IRelatableEntity>(returnValue.GetType())) { var casted = (IRelatableEntity)returnValue; groupRepo.SetGroupRelationProxyLazyLoadDelegate(casted); } return(returnValue); }
internal static Revision <T> GetLatestRevision <T>(this IEnumerable <IReadonlyProviderRevisionRepository <T> > readonlyRepositories, HiveId hiveId, Uri idRoot, RevisionStatusType revisionStatusType = null) where T : class, IVersionableEntity { Revision <T> returnValue = null; //TODO: Determine which repo is the primary one //TODO: Ensure population of the incoming queue is sorted by Ordinal foreach (var reader in readonlyRepositories) { returnValue = reader.GetLatestRevision <T>(hiveId, revisionStatusType); if (returnValue != null) { break; } } return(GroupSessionHelper.MakeIdsAbsolute(returnValue, idRoot)); }