internal static EntitySnapshot <T> SetSnapshotProxyLazyLoadDelegate <T>(this IReadonlyProviderRevisionRepository <T> providerSession, EntitySnapshot <T> entity) where T : class, IVersionableEntity { if (entity == null) { return(null); } entity.Revision.Item.RelationProxies.LazyLoadDelegate = x => { if (providerSession.RelatedEntitiesLoader == null) { throw new NotSupportedException("Dynamically loading relations via an EntitySnapshot<T> object is not supported because a Revision repository does not have a reference to its parent ICoreRelationsRepository via the RelatedEntitiesDelegate property."); } return(providerSession.RelatedEntitiesLoader.Invoke(entity.Revision.Item.Id)); }; return(entity); }
private static Func <Revision <T>, bool> SkipAndMerge <T>(IReadonlyProviderRevisionRepository <T> reader, IEnumerable <Revision <T> > totalOutput) where T : class, IVersionableEntity { return(x => x == null || totalOutput.Any(y => reader.ProviderMetadata.IsPassthroughProvider ? y.MetaData.Id.EqualsIgnoringProviderId(x.MetaData.Id) : y.MetaData.Id == x.MetaData.Id)); }