diff --git a/YouTubeViewers.WPF/App.xaml.cs b/YouTubeViewers.WPF/App.xaml.cs index e9243af..4aefd39 100644 --- a/YouTubeViewers.WPF/App.xaml.cs +++ b/YouTubeViewers.WPF/App.xaml.cs @@ -16,6 +16,7 @@ using YouTubeViewers.EntityFramework.Commands; using YouTubeViewers.EntityFramework.Queries; using YouTubeViewers.WPF.Stores; using YouTubeViewers.WPF.ViewModels; +using YouTubeViewers.WPF.HostBuilders; namespace YouTubeViewers.WPF; @@ -27,15 +28,9 @@ public partial class App : Application public App() { _host = Host.CreateDefaultBuilder() + .AddDbContext() .ConfigureServices((context, services) => { - string connectionString = context.Configuration.GetConnectionString("sqlite"); - services.AddSingleton( - new DbContextOptionsBuilder() - .UseSqlite(connectionString) - .Options); - services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/YouTubeViewers.WPF/Components/YouTubeViewersDetails.xaml b/YouTubeViewers.WPF/Components/YouTubeViewersDetails.xaml index 951da39..7104e14 100644 --- a/YouTubeViewers.WPF/Components/YouTubeViewersDetails.xaml +++ b/YouTubeViewers.WPF/Components/YouTubeViewersDetails.xaml @@ -43,7 +43,8 @@ + Text="{Binding UserName}" + TextWrapping="Wrap"/> diff --git a/YouTubeViewers.WPF/Components/YouTubeViewersListing.xaml b/YouTubeViewers.WPF/Components/YouTubeViewersListing.xaml index 3f51eaf..b977be6 100644 --- a/YouTubeViewers.WPF/Components/YouTubeViewersListing.xaml +++ b/YouTubeViewers.WPF/Components/YouTubeViewersListing.xaml @@ -21,7 +21,10 @@ x:Name="border" Background="White" CornerRadius="5"/> - diff --git a/YouTubeViewers.WPF/Components/YouTubeViewersListingItem.xaml b/YouTubeViewers.WPF/Components/YouTubeViewersListingItem.xaml index 8b75c39..2e3ae48 100644 --- a/YouTubeViewers.WPF/Components/YouTubeViewersListingItem.xaml +++ b/YouTubeViewers.WPF/Components/YouTubeViewersListingItem.xaml @@ -18,7 +18,7 @@ - + + { + string connectionString = context.Configuration.GetConnectionString("sqlite"); + services.AddSingleton(new DbContextOptionsBuilder().UseSqlite(connectionString).Options); + services.AddSingleton(); + }); + return hostBuilder; + } + } +} diff --git a/YouTubeViewers.WPF/MainWindow.xaml b/YouTubeViewers.WPF/MainWindow.xaml index 99ea9c1..ef4a580 100644 --- a/YouTubeViewers.WPF/MainWindow.xaml +++ b/YouTubeViewers.WPF/MainWindow.xaml @@ -27,8 +27,8 @@ - - + +