Ejemplo n.º 1
0
        public DbMaintainer(
            [FromServices] Dbc dbc,
            [FromServices] GenreStore genreStore,
            [FromServices] ArtistStore artistStore,
            [FromServices] AlbumStore albumStore,
            [FromServices] ArtistAlbumStore artistAlbumStore,
            [FromServices] GenreAlbumStore genreAlbumStore,
            [FromServices] GenreArtistStore genreArtistStore
        )
        {
            this._dbc = dbc;
            this._genreStore = genreStore;
            this._artistStore = artistStore;
            this._albumStore = albumStore;
            this._artistAlbumStore = artistAlbumStore;
            this._genreAlbumStore = genreAlbumStore;
            this._genreArtistStore = genreArtistStore;

            DbMaintainer._instance = this;
        }
Ejemplo n.º 2
0
        private bool _isDisposed = false; // 重複する呼び出しを検出するには

        protected virtual void Dispose(bool disposing)
        {
            if (!this._isDisposed)
            {
                if (disposing)
                {
                    if (
                        this._albumScannerCanceler != null
                        || this._dbUpdaterCanceler != null
                    )
                    {
                        this.StopAllTasks()
                            .GetAwaiter()
                            .GetResult();
                    }

                    this._genreStore.Dispose();
                    this._albumStore.Dispose();
                    this._artistStore.Dispose();
                    this._artistAlbumStore.Dispose();
                    this._genreAlbumStore.Dispose();
                    this._genreArtistStore.Dispose();
                    this._dbc.Dispose();
                    this._updaters?.Clear();

                    this._genreStore = null;
                    this._albumStore = null;
                    this._artistStore = null;
                    this._artistAlbumStore = null;
                    this._genreAlbumStore = null;
                    this._genreArtistStore = null;
                    this._dbc = null;
                    this._updaters = null;
                    this._message = null;
                }

                this._isDisposed = true;
            }
        }