示例#1
0
        /// <summary>
        /// Commit entikty to database
        /// </summary>
        public override void Commit()
        {
            // commits data into the database
            CreateOrUpdate();

            foreach (Artist artist in RelatedArtists.Values)
            {
                // Commits all related artists
                if (artist.Logo != null)
                {
                    artist.Commit();
                    InsertUpdateArtistRelationInDB(artist);
                }
            }

            foreach (MusicStyle musicStyle in MusicStyles.Values)
            {
                // Commits all related music styles
                musicStyle.Commit();
                InsertUpdateArtistMusicStyleInDB(musicStyle);
            }

            foreach (Album album in Albums.Values)
            {
                // Commits all albums
                album.Commit(this);
            }

            // registers the logo in the database
            if (Logo != null)
            {
                Logo.Commit();
            }
        }
        /// <summary>
        /// Commit entity to database
        /// </summary>
        public void Commit(Artist artist)
        {
            // commits data into the database
            CreateOrUpdate();

            // creates the association between artist and album
            if (artist != null)
            {
                InsertUpdateArtistAlbumRelationInDB(artist);
            }

            foreach (Song song in Songs.Values)
            {
                song.Commit(this);
            }

            // registers the logo in the database
            if (Logo != null)
            {
                Logo.Commit();
            }
        }