protected override void OnStartup(StartupEventArgs e) { var startupService = new StartupService(); var services = startupService.Configure(); var configuration = startupService.ConfigureSettings(); services.AddDbContext <FindMusicContext>((serviceProvider, options) => { var connectionString = configuration.GetConnectionString("Storage"); options.UseSqlite(connectionString); }); var provider = startupService.BuildProvider(services); var findMusic = provider.Resolve <FindMusicViewModel>(); var window = new MainWindow { DataContext = findMusic }; Current.MainWindow = window; window.Show(); base.OnStartup(e); }