|
|
|
@ -24,7 +24,7 @@ namespace ex_042_011_EF_CF_Many_to_Many_FluentAPI
|
|
|
|
|
/// le sujet réel wrappé par le procurateur
|
|
|
|
|
/// lorsqu'il est setté, la collection d'artistes est mise à jour
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Album Album
|
|
|
|
|
private Album Album
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
@ -33,7 +33,7 @@ namespace ex_042_011_EF_CF_Many_to_Many_FluentAPI
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
album = value;
|
|
|
|
|
UpdateArtistes();
|
|
|
|
|
//UpdateArtistes();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private Album album;
|
|
|
|
@ -50,27 +50,27 @@ namespace ex_042_011_EF_CF_Many_to_Many_FluentAPI
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
albumsArtistes = value;
|
|
|
|
|
UpdateArtistes();
|
|
|
|
|
//UpdateArtistes();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private ICollection<AlbumArtiste> albumsArtistes = new List<AlbumArtiste>();
|
|
|
|
|
|
|
|
|
|
private void UpdateArtistes()
|
|
|
|
|
{
|
|
|
|
|
if (Album != null && AlbumsArtistes != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var art in AlbumsArtistes.Select(aa => aa.Artiste.Artiste))
|
|
|
|
|
{
|
|
|
|
|
Album.Artistes.Add(art);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//private void UpdateArtistes()
|
|
|
|
|
//{
|
|
|
|
|
// if (Album != null && AlbumsArtistes != null)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var art in AlbumsArtistes.Select(aa => aa.Artiste.Artiste))
|
|
|
|
|
// {
|
|
|
|
|
// Album.Artistes.Add(art);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public ICollection<Artiste> Artistes
|
|
|
|
|
public ICollection<IArtiste> Artistes
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Album.Artistes;
|
|
|
|
|
return AlbumsArtistes.Select<AlbumArtiste, IArtiste>(aa => aa.Artiste).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -98,12 +98,24 @@ namespace ex_042_011_EF_CF_Many_to_Many_FluentAPI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Guid uniqueId;
|
|
|
|
|
//private Guid uniqueId;
|
|
|
|
|
|
|
|
|
|
public Guid UniqueId
|
|
|
|
|
{
|
|
|
|
|
get { return uniqueId; }
|
|
|
|
|
set { uniqueId = value; Album.UniqueId = value; }
|
|
|
|
|
//get { return uniqueId; }
|
|
|
|
|
get => Album.UniqueId;
|
|
|
|
|
//set { uniqueId = value; Album.UniqueId = value; }
|
|
|
|
|
set => Album.UniqueId = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AlbumEF()
|
|
|
|
|
{
|
|
|
|
|
Album = new Album();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AlbumEF(Album album)
|
|
|
|
|
{
|
|
|
|
|
Album = album;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|