private IQueryable <Album> CreateQuery( AlbumQueryParams queryParams, ParsedAlbumQuery parsedQuery, NameMatchMode?nameMatchMode = null) { var artistIds = EntryIdsCollection.CreateWithFallback(queryParams.ArtistParticipation.ArtistIds.Ids, parsedQuery.ArtistId); var textQuery = SearchTextQuery.Create(parsedQuery.Name, nameMatchMode ?? queryParams.Common.NameMatchMode); var query = Query <Album>() .WhereIsDeleted(queryParams.Deleted) .WhereHasName(textQuery, allowCatNum: true) .WhereStatusIs(queryParams.Common.EntryStatus) .WhereHasArtistParticipationStatus(queryParams.ArtistParticipation, artistIds, querySource.OfType <Artist>()) .WhereHasBarcode(queryParams.Barcode) .WhereHasType(queryParams.AlbumType) .WhereHasTags(queryParams.TagIds, queryParams.ChildTags) .WhereHasTags(queryParams.Tags) .WhereHasTag(parsedQuery.TagName) .WhereReleaseDateIsAfter(queryParams.ReleaseDateAfter) .WhereReleaseDateIsBefore(queryParams.ReleaseDateBefore) .WhereSortBy(queryParams.SortRule) .WhereMatchFilters(queryParams.AdvancedFilters); return(query); }
public ArtistParticipationQueryParams(EntryIdsCollection artistIds, ArtistAlbumParticipationStatus participation, bool childVoicebanks, bool includeMembers) { ArtistIds = artistIds; Participation = participation; ChildVoicebanks = childVoicebanks; IncludeMembers = includeMembers; }
public static IQueryable <Album> WhereHasArtistParticipationStatus( this IQueryable <Album> query, EntryIdsCollection artistIds, ArtistAlbumParticipationStatus participation, bool childVoicebanks, Func <int, Artist> artistGetter) { var various = Model.Helpers.ArtistHelper.VariousArtists; var producerRoles = ArtistRoles.Composer | ArtistRoles.Arranger; var artistId = artistIds.Primary; return(EntryWithArtistsQueryableExtender.WhereHasArtistParticipationStatus(new ArtistParticipationQueryParams <Album, ArtistForAlbum>(query, artistIds, participation, childVoicebanks, artistGetter, al => al.AllArtists.Any(a => a.Artist.Id == artistId && !a.IsSupport && ((a.Roles == ArtistRoles.Default) || ((a.Roles & producerRoles) != ArtistRoles.Default)) && a.Album.ArtistString.Default != various), al => al.AllArtists.Any(a => a.Artist.Id == artistId && (a.IsSupport || ((a.Roles != ArtistRoles.Default) && ((a.Roles & producerRoles) == ArtistRoles.Default)) || a.Album.ArtistString.Default == various)) ))); }
public ArtistParticipationQueryParams(IQueryable <TEntry> query, EntryIdsCollection artistIds, ArtistAlbumParticipationStatus participation, bool childVoicebanks, Func <int, Artist> artistGetter, Expression <Func <TEntry, bool> > mainEntriesExpression, Expression <Func <TEntry, bool> > collaborationsExpression) : this() { Query = query; ArtistIds = artistIds; Participation = participation; ChildVoicebanks = childVoicebanks; ArtistGetter = artistGetter; MainEntriesExpression = mainEntriesExpression; CollaborationsExpression = collaborationsExpression; }
public static IQueryable <T> WhereSongHasArtists <T>(this IQueryable <T> query, EntryIdsCollection artistIds, bool childVoicebanks) where T : ISongLink { if (!artistIds.HasAny) { return(query); } return(artistIds.Ids.Aggregate(query, (current, artistId) => current.WhereSongHasArtist(artistId, childVoicebanks))); }
public static IQueryable <T> WhereSongHasAnyArtist <T>(this IQueryable <T> query, EntryIdsCollection artistIds, bool childVoicebanks) where T : ISongLink { if (!artistIds.HasAny) { return(query); } return(query.Where(s => s.Song.AllArtists.Any(a => artistIds.Ids.Contains(a.Artist.Id)))); }
public static IQueryable <T> WhereSongHasArtists <T>(this IQueryable <T> query, EntryIdsCollection artistIds, bool childVoicebanks, LogicalGrouping grouping) where T : ISongLink { return(grouping == LogicalGrouping.And ? WhereSongHasArtists(query, artistIds, childVoicebanks) : WhereSongHasAnyArtist(query, artistIds, childVoicebanks)); }
public static IQueryable <TEntry> WhereHasArtists <TEntry, TArtistLink>(this IQueryable <TEntry> query, EntryIdsCollection artistIds, bool childVoicebanks, bool includeMembers) where TEntry : IEntryWithArtistLinks <TArtistLink> where TArtistLink : IArtistLink { if (!artistIds.HasAny) { return(query); } return(artistIds.Ids.Aggregate(query, (current, artistId) => current.WhereHasArtist <TEntry, TArtistLink>(artistId, childVoicebanks, includeMembers))); }
public static IQueryable <ReleaseEvent> WhereHasArtists(this IQueryable <ReleaseEvent> query, EntryIdsCollection artistIds, bool childVoicebanks, bool includeMembers) { if (!artistIds.HasAny) { return(query); } return(query.WhereHasArtists <ReleaseEvent, ArtistForEvent>(artistIds, childVoicebanks, includeMembers)); }