private static async Task <FolderEntity> FindFolder(MusicDbContext context, ItemId id, CancellationToken cancellationToken)
        {
            var entityId = id.ToInt32();

            return(await context.Folders
                   .SingleAsync(f => f.Id == entityId, cancellationToken));
        }
Beispiel #2
0
        private static async Task <AdviseSetEntity> FindAdviseSet(MusicDbContext context, ItemId id, CancellationToken cancellationToken)
        {
            var entityId = id.ToInt32();

            return(await context.AdviseSets
                   .SingleAsync(x => x.Id == entityId, cancellationToken));
        }
        private static async Task <SongEntity> FindSong(MusicDbContext context, ItemId id, CancellationToken cancellationToken, bool includePlaybacks = false)
        {
            IQueryable <SongEntity> queryable = context.Songs;

            if (includePlaybacks)
            {
                queryable = queryable.Include(s => s.Playbacks);
            }

            var entityId = id.ToInt32();

            return(await queryable
                   .SingleAsync(s => s.Id == entityId, cancellationToken));
        }