public IEnumerable <AlbumBE> GetAlbums() { var ids = Context.Album.Where(p => p.ArtistId == Id).Select(p => p.AlbumId); foreach (var id in ids) { var item = new AlbumBE(CRUDTestDBContextProvider); item.Load(id); yield return(item); } }
/// <summary> /// Return all AlbumBEs /// </summary> /// <returns></returns> public IEnumerable <AlbumBE> GetAlbumBEs() { using var context = cRUDTestDBContextProvider.GetContext(); foreach (var id in context.Album.Select(p => p.AlbumId)) { AlbumBE albumBE = new AlbumBE(cRUDTestDBContextProvider); albumBE.Load(id); yield return(albumBE); } yield break; }