Leitungen können nun bearbeitet werden
This commit is contained in:
@@ -10,6 +10,8 @@ using DaSaSo.ViewModel.Factories;
|
||||
using DaSaSo.ViewModel.Interface;
|
||||
using DaSaSo.ViewModel.State.ActualState;
|
||||
using DaSaSo.ViewModel.State.Navigation;
|
||||
using DaSaSo.Wpf.HostBuilders;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
@@ -32,6 +34,14 @@ namespace DaSaSo.Wpf
|
||||
public static IHostBuilder CreateHostBuilder(string[]? args = null)
|
||||
{
|
||||
return Host.CreateDefaultBuilder(args)
|
||||
.AddConfiguration()
|
||||
.AddServices()
|
||||
.AddViewModels()
|
||||
.AddStores()
|
||||
.AddDBContext();
|
||||
}
|
||||
|
||||
/* return Host.CreateDefaultBuilder(args)
|
||||
.ConfigureAppConfiguration(c=>
|
||||
{
|
||||
c.AddJsonFile("appsettings.json");
|
||||
@@ -41,7 +51,8 @@ namespace DaSaSo.Wpf
|
||||
{
|
||||
|
||||
string connectionString = context.Configuration.GetConnectionString("default");
|
||||
|
||||
|
||||
services.AddDbContext<DaSaSoDbContext>(o => o.UseSqlServer(connectionString));
|
||||
services.AddSingleton<DaSaSoDbContextFactory>(new DaSaSoDbContextFactory(connectionString));
|
||||
|
||||
services.AddSingleton<IDataService<Client>, ClientDataService>();
|
||||
@@ -72,7 +83,6 @@ namespace DaSaSo.Wpf
|
||||
services.AddSingleton<CreateViewModel<SewerStammdatenViewModel>>(services =>
|
||||
{
|
||||
return () => new SewerStammdatenViewModel(
|
||||
services.GetRequiredService<IDataService<SewerObject>>(),
|
||||
services.GetRequiredService<IActualProject>()
|
||||
);
|
||||
});
|
||||
@@ -93,9 +103,14 @@ namespace DaSaSo.Wpf
|
||||
services.AddSingleton<CreateViewModel<SewerMainListViewModel>>(services =>
|
||||
{
|
||||
return () => new SewerMainListViewModel(
|
||||
services.GetRequiredService<IDataService<SewerObject>>(),
|
||||
services.GetRequiredService<ISewerMainNavigator>(),
|
||||
services.GetRequiredService<IActualProject>(),
|
||||
services.GetRequiredService<IViewModelSewerMainFactory>()
|
||||
services.GetRequiredService<IViewModelSewerMainFactory>(),
|
||||
new ViewModelDelegateRenavigator(
|
||||
services.GetRequiredService<IMainWindowNavigator>()
|
||||
),
|
||||
services.GetRequiredService<ISewerObjectService>()
|
||||
);
|
||||
});
|
||||
services.AddSingleton<CreateViewModel<ProjectListViewModel>>(services =>
|
||||
@@ -138,14 +153,19 @@ namespace DaSaSo.Wpf
|
||||
services.AddScoped<MainWindowViewModel>();
|
||||
});
|
||||
}
|
||||
*/
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
|
||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||
|
||||
|
||||
_host.Start();
|
||||
|
||||
DaSaSoDbContextFactory contextFactory = _host.Services.GetRequiredService<DaSaSoDbContextFactory>();
|
||||
using (DaSaSoDbContext context = contextFactory.CreateDbContext())
|
||||
{
|
||||
context.Database.Migrate();
|
||||
}
|
||||
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
|
||||
window.Show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user