private async Task AssertResourcesExistAsync(ICollection <IIdentifiable> secondaryResourceIds, CancellationToken cancellationToken)
        {
            var queryLayer = _queryLayerComposer.ComposeForGetRelationshipRightIds(_request.Relationship, secondaryResourceIds);

            var missingResources = await GetMissingRightResourcesAsync(queryLayer, _request.Relationship, secondaryResourceIds, cancellationToken).ToListAsync(cancellationToken);

            if (missingResources.Any())
            {
                throw new ResourcesInRelationshipsNotFoundException(missingResources);
            }
        }
예제 #2
0
        protected async Task AssertRightResourcesExistAsync(object rightResourceIds, CancellationToken cancellationToken)
        {
            ICollection <IIdentifiable> secondaryResourceIds = _collectionConverter.ExtractResources(rightResourceIds);

            if (secondaryResourceIds.Any())
            {
                QueryLayer queryLayer = _queryLayerComposer.ComposeForGetRelationshipRightIds(_request.Relationship, secondaryResourceIds);

                List <MissingResourceInRelationship> missingResources =
                    await GetMissingRightResourcesAsync(queryLayer, _request.Relationship, secondaryResourceIds, cancellationToken)
                    .ToListAsync(cancellationToken);

                if (missingResources.Any())
                {
                    throw new ResourcesInRelationshipsNotFoundException(missingResources);
                }
            }
        }