From 100685931cf68d8e06d42990ffea262166b029a4 Mon Sep 17 00:00:00 2001 From: parap Date: Tue, 9 May 2023 00:37:14 +0400 Subject: [PATCH] lab 8 full --- Pizzeria/Pizzeria/Program.cs | 14 +++++--------- .../PizzeriaContracts/ViewModels/PizzaViewModel.cs | 1 + .../PizzeriaDatabaseImplement.csproj | 4 ++++ .../PizzeriaListImplement.csproj | 4 ++++ .../PizzeriaFileImplement.csproj | 4 ++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Pizzeria/Pizzeria/Program.cs b/Pizzeria/Pizzeria/Program.cs index 61c7678..1564837 100644 --- a/Pizzeria/Pizzeria/Program.cs +++ b/Pizzeria/Pizzeria/Program.cs @@ -15,11 +15,6 @@ namespace Pizzeria { internal static class Program { - private static ServiceProvider? _serviceProvider; - public static ServiceProvider? ServiceProvider => _serviceProvider; - /// - /// The main entry point for the application. - /// [STAThread] static void Main() { @@ -30,7 +25,7 @@ namespace Pizzeria InitDependency(); try { - var mailSender = _serviceProvider.GetService(); + var mailSender = DependencyManager.Instance.Resolve(); mailSender?.MailConfig(new MailConfigBindingModel { MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty, @@ -49,7 +44,7 @@ namespace Pizzeria var logger = DependencyManager.Instance.Resolve(); logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé"); } - Application.Run(_serviceProvider.GetRequiredService()); + Application.Run(DependencyManager.Instance.Resolve()); } private static void InitDependency() { @@ -76,6 +71,8 @@ namespace Pizzeria DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(true); + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); @@ -90,7 +87,6 @@ namespace Pizzeria DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); } - private static void MailCheck(object obj) => - ServiceProvider?.GetService()?.MailCheck(); + private static void MailCheck(object obj) => DependencyManager.Instance.Resolve()?.MailCheck(); } } \ No newline at end of file diff --git a/Pizzeria/PizzeriaContracts/ViewModels/PizzaViewModel.cs b/Pizzeria/PizzeriaContracts/ViewModels/PizzaViewModel.cs index 2d4ec9c..c62f36b 100644 --- a/Pizzeria/PizzeriaContracts/ViewModels/PizzaViewModel.cs +++ b/Pizzeria/PizzeriaContracts/ViewModels/PizzaViewModel.cs @@ -17,6 +17,7 @@ namespace PizzeriaContracts.ViewModels public string PizzaName { get; set; } = string.Empty; [Column("Цена", width: 100)] public double Price { get; set; } + [Column(visible: false)] public Dictionary PizzaComponents { get; diff --git a/Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabaseImplement.csproj b/Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabaseImplement.csproj index 8d8372c..e324bc2 100644 --- a/Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabaseImplement.csproj +++ b/Pizzeria/PizzeriaDatabaseImplement/PizzeriaDatabaseImplement.csproj @@ -21,4 +21,8 @@ + + + + diff --git a/Pizzeria/PizzeriaListImplement/PizzeriaListImplement.csproj b/Pizzeria/PizzeriaListImplement/PizzeriaListImplement.csproj index b612a23..f828762 100644 --- a/Pizzeria/PizzeriaListImplement/PizzeriaListImplement.csproj +++ b/Pizzeria/PizzeriaListImplement/PizzeriaListImplement.csproj @@ -11,4 +11,8 @@ + + + + diff --git a/Pizzeria/PizzeriaShopFileImplement/PizzeriaFileImplement.csproj b/Pizzeria/PizzeriaShopFileImplement/PizzeriaFileImplement.csproj index b612a23..f828762 100644 --- a/Pizzeria/PizzeriaShopFileImplement/PizzeriaFileImplement.csproj +++ b/Pizzeria/PizzeriaShopFileImplement/PizzeriaFileImplement.csproj @@ -11,4 +11,8 @@ + + + +